sanity-io/template-nextjs-personal-website

RevalidateTag fails randomly on production

valse opened this issue · 6 comments

Hi, I'm facing same issues with the current revalidate setting on the loadQuery method because on production in a Vercel web app, revalidating by the webhook not all the pages with the desired tag are refreshed correctly.

Disabling the cache on the loadQuery revalidate property all works as expected.

Why you've chosen to enable the cache in this scenario?

Thanks!

Can you elaborate what you mean by works correctly?
If you refresh multiple times after the revalidateTag call is made does it eventually show the new content? Or is it "stuck" forever on some pages no matter what you do?

Hi, exactly the second one: if you have for example 2 pages with the same tag sometimes the revalidate purge both, sometimes only one or none of them.
Keeping the revalidate like this:

let revalidate: NextFetchRequestConfig['revalidate'] = 0

It works as expected refreshing always all the contents.

I just realized that disabling the cache setting the revalidate to 0 is like having a dynamic page that queries sanity for each requests 🤦🏼‍♂️

I saw that it's a bug using the generateStaticParams feature: avoiding it but using the cache, setting the revalidate properties to false, the page caches the calls to sanity until the next revalidateTag request.

Hi @valse, I have exactly the same problem that when I update a project from the starter template, the preview for the project on the home page is revalidated but not the individual project page. This is related to the problem you linked and the only thing to do is to wait until the next team has found a solution, correct?

Hi @nikolailehbrink... yes for the moment the problem still exists but I found a workaround that not prerender the pages on build but it cache the requests and revalidate them.

Oh wow! 😄 Okay, I will look into it! Thank you @valse!