Next.js Discord

Discord Forum

Disable cache for a specific page

Unanswered
American black bear posted this in #help-forum
Open in Discord
American black bearOP
I have a page that can render two different types of content.

/app/[slug]/page.tsx

When there is just a slug, I render the page with the content. If there is a query, I render the page with the content and some additional information available only when the query is present

For example, if I open /slug?query=something, the extra content will show up. However, if I navigate back and open the same page without the query, the content persists with a lot of undefined values because the query is missing, and it's not possible to load the necessary information

I've already added this to the page: export const fetchCache = 'force-no-store';, removed staleTime from React Query and disabled the cache in Apollo Client, but nothing seems to work...

0 Replies