Is it possible to persist in localstorage (or similar) until offline is ready?
See original GitHub issueI read docs on website and offline RFC issue.
But then I saw this code in this file: https://github.com/FormidableLabs/urql/blob/master/exchanges/graphcache/src/cacheExchange.ts
export interface CacheExchangeOpts {
updates?: Partial<UpdatesConfig>;
resolvers?: ResolverConfig;
optimistic?: OptimisticMutationConfig;
keys?: KeyingConfig;
schema?: IntrospectionQuery;
storage?: StorageAdapter;
}
So the questionis:
Until https://github.com/FormidableLabs/urql/issues/683 is ready, is it possible to use localstorage today at least temporarily?
Something like: https://github.com/apollographql/apollo-cache-persist?
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (14 by maintainers)
Top Results From Across the Web
Is it possible to persist in localstorage (or similar) until offline is ...
I would advise not to store too much in local storage. On some platforms you'll run into performance limitations and that's also a...
Read more >JavaScript LocalStorage: a Complete Guide
Data in localStorage, though, persists until it is cleared. ... localStorage enables you to take your work offline, just like with Wordle.
Read more >localForage: Managing offline browser storage - LogRocket Blog
For such needs, browsers provide two main storage mechanisms that are persistent and accessible offline: localStorage and IndexedDB.
Read more >Web Storage API - MDN Web Docs - Mozilla
localStorage does the same thing, but persists even when the browser is closed and reopened. Stores data with no expiration date, ...
Read more >Please Stop Using Local Storage - DEV Community
It still limits the size of data you can store (~5MB across all major browsers). This is a fairly low limit for people...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The persistence is indeed already functional and you can find an example of this in our
persisted-store
sample app: https://github.com/FormidableLabs/urql/blob/master/exchanges/graphcache/examples/persisted-store/src/app/index.tsxThat persistence is fully functional but we may make small tweaks to the API as we’re adding full offline support. Overall it should be stable and work correctly, but do treat it as experimental until it’s documented and announced please ♥️
When you use it, it should fully work as expected minus what’s mentioned in the RFC, eg optimistic mutations having special handling when a mutation fails due to being offline, or ignoring certain errored results.
Well, the question itself is answered so the typically close the issue out after a response.
But don’t worry, you can keep commenting and ask more questions if you need, even when the issue is closed! 🙌
Btw, I’ve noticed you’re opening a lot of issues that end up being questions rather than bugs or actual issues. Maybe you’ll want to take a look at our Spectrum community? It may be a better place for us to help you with questions since it’s more of a message board / forum