vercel / vercel/next.js

Docs: Add explanation why CacheHandler.revalidateTag never gets called using Pages Router

Open
#65,736 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

What is the update you wish to see?

Update the ISR documentation for Pages Router to explain what revalidate will actually do. Point out that CacheHandler.revalidateTag will never get called and does not need to be implemented. Fix the example that is showing revalidateTag having an implementation.

Is there any context that might help us understand?

The docs suggest that you can implement a custom CacheHandler with the following interface:

  • get
  • set
  • revalidateTag

This is suggested for both App and Page routers respectively using the exact same code.

I have tried a bunch of different setups and whatever I do revalidateTag never appears to be called.
What happens is the following:

  • revalidate api endpoint gets called
  • within the api endpoint await response.revalidate(path) gets called
  • this triggers CacheHandler.get which returns no cache value
  • then getStaticProps gets called
  • lastly CacheHandler.set gets called to store the cache value
Does the docs page already exist? Please link to it.

https://nextjs.org/docs/pages/building-your-application/deploying#caching-and-isr

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Pages Router Caching and ISR documentation at the linked page and compare its custom CacheHandler example with the App Router version. Explain what revalidate does, clarify that CacheHandler.revalidateTag is not called for the Pages Router, and remove that implementation from the example. Done means the Pages Router guidance accurately distinguishes the two router behaviors.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.