Persisting InMemoryCache when using SSR
See original GitHub issueHi there,
What is the recommended way to persist InMemoryCache
when using server side rendering?
If my app was not server side rendered I could just persist to localStorage.
await persistCache({
cache,
storage: window.localStorage,
});
Having trouble trying to figure out how to persist InMemoryCache
when using NextJS.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Advanced topics on caching in Apollo Client
You can persist and rehydrate the InMemoryCache from a storage provider like AsyncStorage or localStorage . To do so, use the apollo3-cache-persist library....
Read more >How to use the apollo-cache-persist.persistCache function in ...
To help you get started, we've selected a few apollo-cache-persist. ... const cache = new InMemoryCache({ fragmentMatcher }) // TODO what should happen...
Read more >Server Side Rendering – Angular - GraphQL Code Generator
class AppModule { cache: InMemoryCache; constructor( apollo: Apollo, ... SSR works out of the box when using HttpLink from ...
Read more >API with NestJS #23. Implementing in-memory cache to ...
In this article, we look into in-memory caching to improve the performance of our application.
Read more >apollo-state-link does not hold state in cache when page is ...
Apollo's InMemoryCache is, well, in-memory, so it's not persisted ... Also, be aware if you're using SSR, there are known issues with using...
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 FreeTop 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
Top GitHub Comments
In my app, I’m using:
I believe this approach means that SSR won’t be able to access the cache but the client will access the cache rather than making network calls once the initial SSR has completed. All calls made from the client will have access to the cache.
I think I’ve managed to add apollo cache persist based on existing example in Next.js - https://github.com/vercel/next.js/pull/29718