Skip to content

feat(organizations): Cache organizations to support offline first UX - #7303

Merged
gatzjames merged 1 commit into
Kong:developfrom
gatzjames:feat/persist-organizations
Apr 23, 2024
Merged

feat(organizations): Cache organizations to support offline first UX#7303
gatzjames merged 1 commit into
Kong:developfrom
gatzjames:feat/persist-organizations

Conversation

@gatzjames

@gatzjames gatzjames commented Apr 23, 2024

Copy link
Copy Markdown
Contributor

Highlights:

  • Caches the results of fetching organizations and user data to allow the app to keep working while offline
  • The data are cached in localStorage instead of in-memory using the accountId as a cache key

Next steps:

  • Evaluate better caching strategies and ttl set from the server
  • Features and Rules for organisations are a bottleneck for performance atm when switching between organisations and could use a better solution
  • Move all localStorage to a file accessible from main context, to avoid localStorage corruption caused by app crashes.
  • Rather than using the localStorage to get data in other loaders, we could first render from the cache with a defer to fetch, or an alternative initial load strategy

notes

  • we cache org, user, plan at app-start, and sync triggered by SSE
  • we read from the cache in three places
  • cache mechanism is different to projects because projects are a intersection of remote and local and orgs, user, and plan is just a copy of whatever it the latest state on the remote.
  • could cache feature rules responses, but would mean first visits would always have delays, could prefetch or could add to org response?

@gatzjames
gatzjames requested a review from a team April 23, 2024 15:08
@gatzjames gatzjames self-assigned this Apr 23, 2024
@gatzjames
gatzjames enabled auto-merge (squash) April 23, 2024 16:21
@gatzjames
gatzjames merged commit 6a69533 into Kong:develop Apr 23, 2024
@gatzjames
gatzjames deleted the feat/persist-organizations branch April 23, 2024 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants