Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revalidateTag() not functioning as expected in versions above 14.2.10 when used directly in page.tsx #70403

Open
JesperCph opened this issue Sep 24, 2024 · 0 comments
Labels
bug Issue was opened via the bug report template.

Comments

@JesperCph
Copy link

Link to the code that reproduces this issue

https://github.com/JesperCph/revalidate-tag-issues-reproduction

To Reproduce

  1. Build and start the app using pnpm build & pnpm start
  2. Open the app at http://localhost:3000/
  3. Time is fetched from /api/time, displayed on the landing page, and cached for 60 seconds with the tag time.
  4. Navigate to the "Revalidate (page)" using the link, which triggers revalidateTag('time').
  5. 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.
@JesperCph JesperCph added the bug Issue was opened via the bug report template. label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

1 participant