urql-graphql / urql

The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
https://urql.dev/goto/docs
MIT License
8.65k stars 454 forks source link

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

Closed kitten closed 1 year ago

kitten commented 1 year ago

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

trcoffman commented 1 year ago

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?