nextjs-blog-cms-sanity-v3 icon indicating copy to clipboard operation
nextjs-blog-cms-sanity-v3 copied to clipboard

Quirks with revalidation on new and unpublished posts

Open tddostu opened this issue 1 year ago • 2 comments

Hello, me again from #93. Thanks @stipsan for sorting that so quickly! I thought I'd make a new issue as this seems slightly different.

Unforuntately I've found a couple of other quirks with revalidation 😬

New posts:

When adding a new post, sometimes, some pages do not get revalidated. The webhook appears to send the right requests on all attempts, but some don't seem to update.

In the video below:

  • I publish 'New Post 3', the webhook sends the correct routes, but it does not update the actual site.
  • I then publish 'New Post 04', the webhook sends the correct routes again, but the site shows only the previous 'New Post 3' update (I promise I'm hitting refresh on the far right multiple times after an update, it's just out of the capture area 🙂).
  • Finally I publish 'New Post 05', the webhook sends the correct routes, all it all works as expected with all pages up to date.

A similar thing (not in the video) happens when I update an authors image. The revalidation routes sent are correct, but only some actaully update (some posts have the old author image, or even a different author if that was changed). The behaviour seems the same as the post issue, with only some pages actually get the new/updated content via on-demand ISR, despite all being requested to do so.

Sometimes however, it seems to all work. I can't quite figure out a pattern behind when it does.

Deleted/unpublished posts:

When deleting a post, everything seems to work fine, revalidation occurs and the post is removed. However if I instead unpublish it, it only requests revalidation for the homepage and the unpublished route, leaving the now unpublished post in the 'More stories' section of other posts.

https://user-images.githubusercontent.com/36751136/203498705-5f4137f0-e0db-4fbc-9bc5-cef8964a1790.mp4

tddostu avatar Nov 23 '22 08:11 tddostu