GraphQL query responses caching in production #1846
-
faust/core@2.1.2 I have an issue where it takes 10+ minutes for updates to a post to appear on the frontend when the frontend is running in "production" aka is a served build. This is not the case when the frontend is running via "dev". The WPGraphQL playground returns the correct query result immediately. I've also ruled out issues with reverse proxy caching (which would exhibit issues in dev as well). I am using DevKinsta to run my backend server. Here are some other things I've tried:
addFilter('apolloClientOptions', 'faust', apolloClientOptions => {
return {
...apolloClientOptions,
cache: new InMemoryCache(),
connectToDevTools: true,
defaultOptions: {
watchQuery: {
fetchPolicy: 'no-cache',
errorPolicy: 'all'
},
query: {
fetchPolicy: 'no-cache',
errorPolicy: 'all'
}
}
};
}); I haven't had a chance to make a minimal reproduction but curious if anyone has encountered a similar problem. Thank you for any and all help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @stalgiag thanks for your comment and illustrating what you've already tried. What you are likely running into is the Next.js revalidate cache. By default, we have a 900 second (15 minute) revalidate set on all Faust template routes. This is to ensure requests to the actual WordPress server are minimized. You can modify this setting here: Here's some more info on Incremental Static Revalidation in Next: |
Beta Was this translation helpful? Give feedback.
Hey @stalgiag thanks for your comment and illustrating what you've already tried.
What you are likely running into is the Next.js revalidate cache. By default, we have a 900 second (15 minute) revalidate set on all Faust template routes. This is to ensure requests to the actual WordPress server are minimized.
You can modify this setting here:
https://faustjs.org/reference/getwordpressprops#configuration
Here's some more info on Incremental Static Revalidation in Next:
https://nextjs.org/docs/pages/building-your-application/data-fetching/incremental-static-regeneration