An Apollo Link (v3+ compatible) that queues all mutations optimistically when offline or on network errors, assuming requests will fail and retrying until success. Designed for speed and resilience on slow/unreliable connections. v1.1.1 is current, tested with @apollo/client ^3.7.14. Unlike other offline solutions, it always queues mutations and relies on optimistic responses for immediate UI feedback. Ships TypeScript types. Requires Apollo Client 3.7.14+, lodash, and uuid as peer dependencies. Active development with regular releases.
npm install apollo-link-offlineNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows full setup of Apollo Client with offline link, cache persistence, and initialization.
Call setup method after client initialization and cache persistence promise resolves.
Always include an optimisticResponse in mutations.
Upgrade to Apollo Client 3.7.14 or later.
Provide a storage adapter that implements getItem, setItem, removeItem (async).
Handle errors explicitly in mutation callbacks or use errorPolicy: 'none' in production.
Ensure new OfflineLink({...}) completes before calling .setup().Call offlineLink.setup(client) after ApolloClient is fully created.
Wrap root component with <ApolloProvider client={client}>.