Open hari-mohan-choudhary opened 6 years ago
you can use this approach https://github.com/facebook/relay/pull/2121 by @felippepuhle
You can improve the network layer to provide offline first support check this https://medium.com/@sibelius/relay-modern-network-deep-dive-ec187629dfd3
You can save relay store to localstorage
or AsyncStorage
like this https://github.com/mrtnzlml/quick-payments/blob/07cd415dbd69709e01919fdf6024ce9e4f701c94/packages/relay/src/Environment.js#L55
and always fallback to it when not connected to internet
One problem I haven't been able to get around is the service worker caching the GQL query. If the site has an update, Relay could be fetching for old data requirements on old React components, because the default service worker behavior is to check the cache before hitting the network.
This is problematic for persisted queries, because the query hashes will rarely match up between service worker and the server on site updates.
I've ended up removing persisted queries from my site, since the performance boost and slight inconvenience of service workers was worth the trade off.
@johntran How does not using persisted queries help? The text version of the query would change along with the hash. Can you describe your setup a bit more?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
hello We are planning our application to develop pwa. Is it possible. we can develop using modern relay. if possible then how we can use cache strategy, offline behaviour, service worker. Please suggest any starter.