Add a new onCacheHydrated method to Urql. This would be called when Urqls cache has been hydrated from disk (e.g. when using the @urql/storage-rn package).
The reason we need this event is so that we can wait for the cache to be hydrated before mounting any components that use Urql. Without it, the app bootstraps very quickly, before Urql has hydrated the cache, causing each query to be awaited from the network. We use the cache-and-network policy, so we want the network to be hit, but we want to show our cached results immediately.
Summary
Add a new
onCacheHydrated
method to Urql. This would be called when Urqls cache has been hydrated from disk (e.g. when using the@urql/storage-rn
package).The reason we need this event is so that we can wait for the cache to be hydrated before mounting any components that use Urql. Without it, the app bootstraps very quickly, before Urql has hydrated the cache, causing each query to be awaited from the network. We use the
cache-and-network
policy, so we want the network to be hit, but we want to show our cached results immediately.Additional discord context
Proposed Solution
Add an event so that we can know when Urqls cache is ready.