Simple persistence for all Apollo Client 3.0 and 4.0 cache implementations, including InMemoryCache and Hermes. Version 1.0.11. Supports web and React Native with multiple storage providers like AsyncStorageWrapper and LocalStorageWrapper. Key differentiator: works with both Apollo Client 3 and 4, simple API with async restore and debounced persistence. Release cadence: active maintenance.
npm install apollo4-cache-persistNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to persist Apollo cache to localStorage on web. Await persistCache before creating ApolloClient.
Check @apollo/client peer dependency: ^3.0.0 || ^4.0.0. Supports both.
Always await persistCache() before instantiation of ApolloClient.
Upgrade to v1.0.0+ and use the options object signature: persistCache({ cache, storage }).Use named imports: import { persistCache, AsyncStorageWrapper } from 'apollo4-cache-persist'.Use import { persistCache } from 'apollo4-cache-persist' instead of import persistCache from 'apollo4-cache-persist'.Ensure you have @apollo/client installed as a peer dependency. Also check tsconfig 'moduleResolution': 'node'.
Use AsyncStorage from @react-native-async-storage/async-storage directly, not instantiated.
Use ES module import: import { ... } from 'apollo4-cache-persist'.