Open wtrocki opened 6 years ago
@wtrocki not sure what solution you ended up coming up with but I had a lot of success with this implementation. It's a combination of Apollo cache persist, and Apollo link retry.
https://medium.com/twostoryrobot/a-recipe-for-offline-support-in-react-apollo-571ad7e6f7f4
I tried using Apollo Link Queue as part of it but it conflicted with the custom <OfflineMutation />
component outlined in that article if you use it for online/offline.
Spent a lot of time trying to get the offline part working. Created a new library: https://github.com/aerogear/offix that does that (and much more) to satisfy offline needs.
Trying to use apollo-link-queue and apollo-link-retry to queue data. In case of problems with the server Apollo retry is going to retry operations. However when page is refreshed entire apollo-link chain will be removed. I wrote my own link to persist state of the operations, however this is not going to restore observers chain.
I think apollo client itself should have way to retry operations (with entire chain) to handle cases when page was refreshed.
Expected Behavior Refresh of the application/website will not cause currently active links to disappear.
Actual Behavior When page is refreshed currently active operation chain is going to be removed causing potential los of data.