feat: Optimize loading of members in the UI
Problem
We load all members all the time which is a bit wasteful but also has the issue that with an ever growing list of members for the larger orgs, we keep having to up the limit.
First attempt I thought - lets paginate everything. The problem is here that we have a lot of logic that relies on having the whole list loaded - yuck. After trying to unpick all that I realised actually we just want a couple of different cases:
- Member count for the org to indicate if invites should be suggested (simple count)
- Full member list for parts of the UI that require it (dashboard collaborators etc.)
- Paginate and automatically check for updates so we at least have a more minimal loading going on
Changes
- [x] Adds a
members_countto the UserType org so that we have it in the app context without additional api calls - [x] Improves the usage of membersLogic so that it only loads data when actually needed
- [x] Caching logic (we don't need to load the entire members list everytime you navigate around - we simply check for updates and merge them in)
đ Stay up-to-date with PostHog coding conventions for a smoother review.
How did you test this code?
đ¸ UI snapshots have been updated
350 snapshot changes in total. 0 added, 350 modified, 0 deleted:
chromium: 0 added, 242 modified, 0 deleted (diff for shard 1, diff for shard 2)webkit: 0 added, 108 modified, 0 deleted (diff for shard 2)
Triggered by this commit.
đ¸ UI snapshots have been updated
344 snapshot changes in total. 0 added, 344 modified, 0 deleted:
chromium: 0 added, 236 modified, 0 deleted (diff for shard 1, diff for shard 2)webkit: 0 added, 108 modified, 0 deleted (diff for shard 2)
Triggered by this commit.
Size Change: +542 B (0%)
Total Size: 820 kB
âšī¸ View Unchanged
| Filename | Size | Change |
|---|---|---|
frontend/dist/toolbar.js |
820 kB | +542 B (0%) |
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label â otherwise this will be closed in another week.
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label â otherwise this will be closed in another week.
đ¸ UI snapshots have been updated
4 snapshot changes in total. 0 added, 4 modified, 0 deleted:
chromium: 0 added, 4 modified, 0 deleted (wasn't pushed!)webkit: 0 added, 0 modified, 0 deleted
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 1)webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
@benjackwhite Airbus is seeing this issue again. https://posthoghelp.zendesk.com/agent/tickets/11485 Any chance we could get this merged soon?
@benjackwhite Airbus is seeing this issue again. https://posthoghelp.zendesk.com/agent/tickets/11485 Any chance we could get this merged soon?
I would love to - just cypress tests holding me back...
đ¸ UI snapshots have been updated
9 snapshot changes in total. 0 added, 9 modified, 0 deleted:
chromium: 0 added, 9 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.
đ¸ 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 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
12 snapshot changes in total. 0 added, 12 modified, 0 deleted:
chromium: 0 added, 12 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 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.