Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Apr 23, 2024

Conversation

gatzjames
Copy link
Contributor

@gatzjames gatzjames commented Apr 23, 2024

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
7 checks passed
@gatzjames gatzjames deleted the feat/persist-organizations branch April 23, 2024 16:25
stefancruz pushed a commit to stefancruz/insomnia that referenced this pull request May 8, 2024
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