posthog icon indicating copy to clipboard operation
posthog copied to clipboard

feat: Optimize loading of members in the UI

Open benjackwhite opened this issue 1 year ago â€ĸ 5 comments

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:

  1. Member count for the org to indicate if invites should be suggested (simple count)
  2. Full member list for parts of the UI that require it (dashboard collaborators etc.)
  3. Paginate and automatically check for updates so we at least have a more minimal loading going on

Changes

  • [x] Adds a members_count to 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?

benjackwhite avatar Jan 26 '24 09:01 benjackwhite

📸 UI snapshots have been updated

350 snapshot changes in total. 0 added, 350 modified, 0 deleted:

Triggered by this commit.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Jan 26 '24 10:01 posthog-bot

📸 UI snapshots have been updated

344 snapshot changes in total. 0 added, 344 modified, 0 deleted:

Triggered by this commit.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Jan 26 '24 10:01 posthog-bot

Size Change: +542 B (0%)

Total Size: 820 kB

â„šī¸ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 820 kB +542 B (0%)

compressed-size-action

github-actions[bot] avatar Jan 26 '24 13:01 github-actions[bot]

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.

posthog-bot avatar Feb 08 '24 07:02 posthog-bot

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.

posthog-bot avatar Feb 16 '24 07:02 posthog-bot

📸 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Mar 07 '24 08:03 posthog-bot

📸 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Mar 07 '24 08:03 posthog-bot

@benjackwhite Airbus is seeing this issue again. https://posthoghelp.zendesk.com/agent/tickets/11485 Any chance we could get this merged soon?

xrdt avatar Mar 08 '24 19:03 xrdt

@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...

benjackwhite avatar Mar 11 '24 08:03 benjackwhite

📸 UI snapshots have been updated

9 snapshot changes in total. 0 added, 9 modified, 0 deleted:

Triggered by this commit.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Mar 11 '24 08:03 posthog-bot

📸 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Mar 11 '24 08:03 posthog-bot

📸 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Mar 11 '24 08:03 posthog-bot

📸 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Mar 11 '24 08:03 posthog-bot

📸 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Mar 11 '24 09:03 posthog-bot

📸 UI snapshots have been updated

12 snapshot changes in total. 0 added, 12 modified, 0 deleted:

Triggered by this commit.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Mar 11 '24 10:03 posthog-bot

📸 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Mar 11 '24 12:03 posthog-bot

📸 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Mar 11 '24 12:03 posthog-bot