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

fix(graphcache): Add missing retries after offline rehydration #3196

Merged
merged 3 commits into from
Apr 29, 2023

Conversation

kitten
Copy link
Member

@kitten kitten commented Apr 28, 2023

Resolves #3093

Summary

Adds missing retries of query operations when offline rehydration has completed and fix the timing of flushing the failed queue of operations after rehydration.

The former can lead to operations only awaiting network requests even after finishing storage rehydration, since no additional operations would be issued.

The latter can lead to stalled operations when the device is offline on load.

Set of changes

  • Add query operations to failedQueue while rehydrating
  • Delay timing of flushQueue to after storage rehydration
  • Move onOnline register to flushQueue

@trcoffman
Copy link
Contributor

trcoffman commented Apr 28, 2023

This looks to me like it would solve #3093, but I'm wondering if it would possibly introduce some kind of issues for the ssrExchange? I don't really have any experience with React SSR or the ssrExchange, so I'm not sure if my concerns have any basis. Could re-executing these queries against the cache after storage hydration cause stale data from the cache to show up in query results, overriding the data from the ssrExchange?

@kitten kitten merged commit ec5fd38 into main Apr 29, 2023
@kitten kitten deleted the fix/offline-storage-timing branch April 29, 2023 11:13
@github-actions github-actions bot mentioned this pull request Apr 29, 2023
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.

Using graphcache@5.0.0 or 6 the cache in the default storage is not loaded anymore on the first page load
2 participants