tropicalfish
tropicalfish

Reputation: 1270

How do I make use of GraphQL Apollo cache for offline support?

I'm building an Apollo app that needs to have offline support.

I understand that Apollo allows us to have direct control to the cache using apollo-cache-inmemory, and with method like writeQuery we are able to mutate the cache data without changing the data on the server.

What's the best approach to sync local cache data with the server, let's say, on a scenario where the app could go offline for a period of time?

Upvotes: 4

Views: 1824

Answers (2)

Richard
Richard

Reputation: 1780

AWS AppSync will handle this for you and has an Apollo plug in:

yarn add aws-appsync
yarn add aws-appsync-react

This will perform offline caching and automatic synchronization as well as conflict resolution. You can also control Optimistic UI using the AppSync plugin and Apollo: https://docs.aws.amazon.com/appsync/latest/devguide/building-a-client-app-react.html#offline-settings

Upvotes: 3

none
none

Reputation: 1787

Did you see this one? Maybe it can help.... https://dev-blog.apollodata.com/announcing-apollo-cache-persist-cb05aec16325

Upvotes: 1

Related Questions