Cache is quite easy to use and it could be even done on network level however this is not representing full offline capabilities. Normally offline capabilities are done by prefetching required data when network is available and users can mitigate that by querying dataset on startup.
Depending on the platform different cache capabilities are available:
- JS: https://github.com/apollographql/apollo-cache-persist - IOS: https://www.apollographql.com/docs/ios/watching-queries.html - Android: https://github.com/apollographql/apollo-android#support-for-cached-responses
Good summary of offline support: - https://github.com/apollographql/apollo-client/issues/424 _"I think Apollo Client can give you some basic offline functionality out of the box, but it only knows how to run queries it's seen before. Since GraphQL arguments don't have any semantic meaning (there is no built-in sorting, filtering, etc) it would be hard to run totally new queries in a generic way."_
I think we can live with that as feature and assume that we have limited query cache functionality. Users will be able to get data projections themselves if they query datasets that will be cached. This is exactly what AWS is doing as well: https://docs.aws.amazon.com/appsync/latest/devguide/building-a-client-app-react.html#offline-settings
For follow up work I would like to focus on doing end to end implementation with https://github.com/apollographql/apollo-cache-persist#storage-providers |
|