apollo-cache-persist-dev (v0.2.1) is a development preview of apollo-cache-persist, providing simple persistence for Apollo Client 2.0+ cache implementations including InMemoryCache and Hermes. It supports web (localStorage) and React Native (AsyncStorage) with automatic restore on app start and persistence on cache writes. Key features include configurable triggers (write, background), debounce, max size limits, and serialization. This dev package includes experimental changes and community PRs not yet merged into the stable release, with potential breaking changes. Alternative to manual cache serialization.
npm install apollo-cache-persist-devNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to persist an InMemoryCache to localStorage using persistCache with key and debug options.
Use the correct package name in package.json and imports.
Use @react-native-async-storage/async-storage for React Native.
Always await persistCache() before new ApolloClient(...).
Use 'write' trigger on web, or provide a custom trigger.
Set maxSize: false for unlimited or increase limit as needed.
Change to: import { persistCache } from 'apollo-cache-persist-dev'npm install @react-native-community/async-storage or switch to @react-native-async-storage/async-storage.
Use: persistCache({...}) without new.