-
Notifications
You must be signed in to change notification settings - Fork 36
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
Proper way to use with Next SSR caching - Always seeing loading state / data not caching #291
Comments
This looks to me like you're forwarding the option the Next.js fetch cache correctly. |
Would there be a way to do the initial fetch using RSC (which seems to respect nextjs caching), passing the data to the client component, and then "patching-in" that cache into the client-side apollo client? Essentially a way to auto-load the rsc-client cache into the browser apollo client cache would be amazing. |
I seem to have answered my own question. Using this approach Apollo Docs: Rehydrating the client-side cache, and passing in the RSC Client's cache into the Usage:
|
Please don't do that, that cannot work correctly in all situations and is not supported! The documentation you linked to is only valid for non-streaming renderToString SSR. |
I see, ok! looking forward to the new support, thank you! |
Actually i think what im doing right now isn't causing multiple concurrent queries, since I'm forcing static on the pages. // page.tsc
// fetching data here with rscClient to cache for 24 hours, renders the page initially instantly without any visible loading state.
export const dynamic = 'force-static';
export const revalidate = 86400; // 24 hours and then bootstrapping this client's cache into the browser cache, but doing a fresh query on the clientside to update the data. |
Hi, first of all thanks for this amazing library.
I'm trying to figure out the proper use for rendering & caching with SSR/Next. I'm using
fetchOptions: { cache: 'force-cache' }
in the SSR Apollo Wrapper. However I'm still seeing my graphql server being hit for every request, and it always shows the loading page for a second or if i disable JS (testing on the deploy).Folder structure:
Full SSR:
Full RSC
Thanks, any help much appreciated.
The text was updated successfully, but these errors were encountered: