Next.js Discord

Discord Forum

Will unstable cache revalidate a static page?

Unanswered
Golden northern bumble bee posted this in #help-forum
Open in Discord
Golden northern bumble beeOP
I am using unstable cache to fetch data that is used on my page. When I build the page (with and without using unstable cache) the output is static. I am not using fetch, but I am using request package for graphql (which is obviously performing a fetch for us).

I am confused by why the page is even being generated as static, but I am also confused if using unstable cache will revalidate a static page if it was used to cache the data for that page?

Thanks!

8 Replies

Golden northern bumble beeOP
This is everyhthing that happens on the page being generated as static (when not using unstable cache). Making a graphql fetch, processing the data, then sending it to a client component.

Why is this page being built as static? I know we don't have any dynamic params (route is just /guns) being used or things like cookies() or headers().

Is the fetch being done in the request method library treated the same as calling it directly as fetch anywhere else in the app?
Can you link the request package your using for graphql?
Try doing this

export const dynamic = 'force-dynamic'
// 'auto' | 'force-dynamic' | 'error' | 'force-static'
Golden northern bumble beeOP
@Jboncz I am using graphql-request. Here is the link https://github.com/jasonkuhrt/graphql-request
Also I am ok with the static page being generated, but I’m assuming the unstable cache will not cause the page to be revalidated, so I added

export const revalidate to end of file