-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache in ssr component and client component #192
Comments
Every time a user makes a request to your server, if you use From that perspective, it should not be necessary to clear the cache again, on top of that. Was this a misunderstanding on your side or am I missing a specific requirement you have here?
That is to be expected. But it doesn't have any "persisting" functionality that would survive a page reload beyond that - just like |
We don't quite understand how to use this client in server components. Our final goal is that we want to store the Query responses on the server, and return them to the front end, so we don't have to make extra queries. And on certain events, clear the cache of certain Query, so that the next query gets the most recent response. Is this possible with this package? |
In React Server Components, this package will always give you a new instance of Apollo Client with an empty cache. If in that environment, you want to cache data over requests, you can do so at network level using the Next.js network cache - Apollo Client will just use that in the background if you configure Next.js accordingly. The same cache will be used in SSR, and then this package will help transport the result over to the browser so that the browser does not need to make a request. |
Hi, we recently started implementing your package in our Next.js application.
There are a few issues we are facing:
In the server components, we send a query like this
Is it possible to clear the cache specifically for this query?
And how to clear the whole cache?
2. If we use the Apollo Wapper, which was created on the basis of this code
Then we have a problem with caching requests. When we reload the page, the cache is completely cleared and
NextSSRInMemoryСache()
works like inInMemoryCache()
We tried to use the experimental hooks
useQuery
,useSuspenseQuery
. but the problem is that using them, we also fail to fully cache queries.How can we fix this problem?
Thanks in advance. I would appreciate your help
The text was updated successfully, but these errors were encountered: