feat: 87% fewer toast messages
Problem
@annikaschmid 's nifty analysis found we toast - alot! We do this in ways that isn't particularly helpful, primarily when:
- You aren't connected to the internet (often happening when you close your laptop or some other thing that loses connection)
- You are logged out for one reason or another and so get 401 errors.
Changes
- Only show a toast if we have a proper error message - if we think it is offline, show a top level banner instead
- If we see a 401, we call the @me endpoint to see if we are for sure logged out and then actually do the logout (redirecting to login)
- Also refactors the api a bit to have some better standard fetch handling
đ Stay up-to-date with PostHog coding conventions for a smoother review.
How did you test this code?
đ¸ UI snapshots have been updated
37 snapshot changes in total. 0 added, 37 modified, 0 deleted:
-
chromium: 0 added, 36 modified, 0 deleted (diff for shard 1, diff for shard 2) -
webkit: 0 added, 1 modified, 0 deleted (diff for shard 2)
Triggered by this commit.
đ¸ UI snapshots have been updated
1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
-
chromium: 0 added, 0 modified, 0 deleted -
webkit: 0 added, 1 modified, 0 deleted (diff for shard 2)
Triggered by this commit.
Size Change: +770 B (0%)
Total Size: 813 kB
âšī¸ View Unchanged
| Filename | Size | Change |
|---|---|---|
frontend/dist/toolbar.js |
813 kB | +770 B (0%) |
đ¸ UI snapshots have been updated
1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
-
chromium: 0 added, 0 modified, 0 deleted -
webkit: 0 added, 1 modified, 0 deleted (diff for shard 2)
Triggered by this commit.
đ¸ UI snapshots have been updated
1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
-
chromium: 0 added, 0 modified, 0 deleted -
webkit: 0 added, 1 modified, 0 deleted (diff for shard 2)
Triggered by this commit.
đ¸ UI snapshots have been updated
9 snapshot changes in total. 0 added, 9 modified, 0 deleted:
-
chromium: 0 added, 8 modified, 0 deleted (diff for shard 2) -
webkit: 0 added, 1 modified, 0 deleted (diff for shard 2)
Triggered by this commit.
đ¸ UI snapshots have been updated
1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
-
chromium: 0 added, 0 modified, 0 deleted -
webkit: 0 added, 1 modified, 0 deleted (diff for shard 2)
Triggered by this commit.
đ¸ UI snapshots have been updated
4 snapshot changes in total. 0 added, 4 modified, 0 deleted:
-
chromium: 0 added, 4 modified, 0 deleted (diff for shard 2) -
webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
đ¸ UI snapshots have been updated
1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
-
chromium: 0 added, 1 modified, 0 deleted (diff for shard 2) -
webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
đ¸ UI snapshots have been updated
1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
-
chromium: 0 added, 1 modified, 0 deleted (diff for shard 2) -
webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
đ¸ UI snapshots have been updated
1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
-
chromium: 0 added, 1 modified, 0 deleted (diff for shard 2) -
webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
đ¸ UI snapshots have been updated
2 snapshot changes in total. 0 added, 2 modified, 0 deleted:
-
chromium: 0 added, 2 modified, 0 deleted (diff for shard 2) -
webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
đ¸ UI snapshots have been updated
2 snapshot changes in total. 0 added, 2 modified, 0 deleted:
-
chromium: 0 added, 2 modified, 0 deleted (diff for shard 1, diff for shard 2) -
webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
đ¸ UI snapshots have been updated
1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
-
chromium: 0 added, 1 modified, 0 deleted (diff for shard 1) -
webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
đ¸ UI snapshots have been updated
1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
-
chromium: 0 added, 1 modified, 0 deleted (diff for shard 2) -
webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
đ¸ UI snapshots have been updated
2 snapshot changes in total. 0 added, 2 modified, 0 deleted:
-
chromium: 0 added, 2 modified, 0 deleted (diff for shard 1, diff for shard 2) -
webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
đ¸ UI snapshots have been updated
2 snapshot changes in total. 0 added, 2 modified, 0 deleted:
-
chromium: 0 added, 2 modified, 0 deleted (diff for shard 1, diff for shard 2) -
webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
đ¸ UI snapshots have been updated
1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
-
chromium: 0 added, 1 modified, 0 deleted (diff for shard 2) -
webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.