Description
Link to the code that reproduces this issue
https://github.com/JesperCph/revalidate-tag-issues-reproduction
To Reproduce
- Build and start the app using
pnpm build
&pnpm start
- Open the app at
http://localhost:3000/
- Time is fetched from
/api/time
, displayed on the landing page, and cached for 60 seconds with the tagtime
. - Navigate to the "Revalidate (page)" using the link, which triggers
revalidateTag('time')
. - Navigate back to the "Home" page ('/'), should fetch the updated time from
/api/time
and display the new value.
Issue
This workflow works as expected in next@14.2.10
and below, but in versions above 14.2.10,
including next@15
, the tag "time" is not revalidated on visiting /revalidate/page.tsx
Callen revalideTag() within a POST server action, works as exspexted. This can be tested by clicking
Revalidate (Form Action)
from the home page, which updates the time.
Current vs. Expected behavior
Current:
The time on the home page /
is not updated when navigating back and forth between /revalidate
and /
using the links.
Expected:
The time on the home page /
should update with the value from /api/time
when navigating back and forth between /revalidate
and /
using the links, as the revalidateTag('time')
function is called from /revalidate/page.tsx
.
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP Fri Mar 29 23:14:13 UTC 2024
Available memory (MB): 15813
Available CPU cores: 20
Binaries:
Node: 19.9.0
npm: 9.6.3
Yarn: 1.22.22
pnpm: 8.15.6
Relevant Packages:
next: 14.2.13 // Latest available version is detected (14.2.13).
eslint-config-next: 14.2.13
react: 18.3.1
react-dom: 18.3.1
typescript: 5.6.2
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next start (local)
Additional context
- The bug was introduced in next@14.2.11.
- When calling
revalidateTag()
within a POST server action, the time is revalidated as expected.