-
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
How to get the latest data #200
Comments
This looks to me like for some reason, Next.js is caching your network requests. The code you share here looks like you are opting out of it, but at the same time, it seems like it doesn't. In React Server components, One thought, though: You should be using the normal export const { getClient } = registerApolloClient(() => {
- return new NextSSRApolloClient({
+ return new ApolloClient({
- cache: new NextSSRInMemoryCache(),
+ cache: new InMemoryCache(),
link: new HttpLink({
uri: APOLLO_CLIENT_URL,
fetchOptions: { cache: 'no-store' },
}),
});
});
|
@phryneas Thank you for the reply After I updated it according to your suggestion, I still can't get the latest data. |
Then at some point, Next.js seems to be caching network requests - see my link above. |
Am I missing the point here? I thought the |
I'm also having this same issue, the data is stale unless the site is rebuilt by vercel. |
My query looks like:
And my Apollo client instance is:
|
@kierangillen What does your component/page look like? it might have to do with https://nextjs.org/docs/app/building-your-application/caching#on-demand-revalidation Specifically the option // Opt out of caching for all data requests in the route segment
export const dynamic = 'force-dynamic' There's also a mention about Vercel's Data Cache right below that section that links to this, take a look it might help with your issue specifically: https://vercel.com/docs/infrastructure/data-cache |
Thanks @luchillo17. I ended up adding |
Yes and no :) The point of But if you call |
Gotcha, @kierangillen's got a fix, now we wait for @bingjian1819 feedback. |
Hi @kierangillen ... i am dealing with similar issues I think. Is your current code something available on Github to review? I am setting |
@lablancas hey sorry the repo I was working in is private. I'd suggest putting in the |
The backend data is updated frequently, but the data I get every time is only the data from the last build. I've tried without caching without success.
The text was updated successfully, but these errors were encountered: