carvajalconsultants / apollo-link-offline

An Apollo Link to queue mutations when offline or network errors exist.
MIT License
71 stars 15 forks source link

Question about compatibility with other 'apollo-link's #15

Open wimramuha opened 1 year ago

wimramuha commented 1 year ago

Hi, I experimmented a bit with apollo-client the last 2 days, and at the moment my stack of 'links' is:

  1. import {RetryLink} from '@apollo/client/link/retry';
  2. import ApolloLinkTimeout from 'apollo-link-timeout';
  3. import {setContext} from '@apollo/client/link/context'; //I add header 'authorization': 'Bearer <JWTtoken>' with this
  4. (the http link)

For query cache persistance I use: import {persistCache} from 'apollo-cache-persist';

=> So what I'm still missing is mutation persistance... I found some guides that use apollo-link-serialize to make sure that mutations are executed in the correct order, but I guess that is not needed If I use apollo-link-offline with 'sequential = true' ?

=> Since 'persistCache' handles only querries, it will not conflict with (AsyncStorage)persistance of apollo-link-offline?

=>Can I use retryOnServerError=false, and count on my RetryLink to handle the retrying, or will that not work and should I block mutation retrying in RetryLink and enable it in apollo-link-offline?

=> Is the correct place to include it in my link stack between 2 and 3 in the list above?

Best regards,

Wim