-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Comments
I have also observed I haven't fully debugged it, but could it be a related issue? |
@markedwards can you provide a reproduction repo? |
I haven't narrowed it down yet, and the actual repro involves setting up a page with an EventStream, and building a stream. It's a bit too complicated. Will dig in to it further, but this issue caught my eye as potentially related. |
i am also encountering errors on my use server function that I did not get before and i can't figure out where they come from
this is my function
|
…rcel#70446) Fixes vercel#70403 ### What? When `revalidateTag()` is called directly in server components, the cache is not purged for the corresponding tags. Reproduction steps available in vercel#70403 ### How? Check [app-render.tsx](https://github.com/vercel/next.js/compare/canary...abhi12299:fix-revalidatetag-rsc?expand=1#diff-a3e2e024db1faa1b501e0dd6040eaaf0d931cb9878ae0fb0f4c3658daa982768) This issue was introduced in vercel#65296 in this file: [revalidate.ts](https://github.com/vercel/next.js/pull/65296/files#diff-7f0cb5bb30d44b9153d724e31c25859b9aab6cc258b35563a1d9464cd0688283). The lines removed from the file resulted in the revalidation checks to be skipped when there is an RSC request. Also fixed checks on `pendingRevalidates` to also check for `revalidatedTags`. --------- Co-authored-by: JJ Kasper <jj@jjsweb.site> # Conflicts: # packages/next/src/server/app-render/app-render.tsx
…0446) (#70642) This backports #70446 to 14-2-1 Fixes #70403 ### What? When `revalidateTag()` is called directly in server components, the cache is not purged for the corresponding tags. Reproduction steps available in #70403 ### How? Check [app-render.tsx](https://github.com/vercel/next.js/compare/canary...abhi12299:fix-revalidatetag-rsc?expand=1#diff-a3e2e024db1faa1b501e0dd6040eaaf0d931cb9878ae0fb0f4c3658daa982768) This issue was introduced in #65296 in this file: [revalidate.ts](https://github.com/vercel/next.js/pull/65296/files#diff-7f0cb5bb30d44b9153d724e31c25859b9aab6cc258b35563a1d9464cd0688283). The lines removed from the file resulted in the revalidation checks to be skipped when there is an RSC request. Also fixed checks on `pendingRevalidates` to also check for `revalidatedTags`. Co-authored-by: Abhishek Mehandiratta <36722596+abhi12299@users.noreply.github.com>
As far as I can tell, cache revalidation is simply broken when called in a streaming callback in a route handler. I'll see if I can get a minimal repro and create an issue. |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://github.com/JesperCph/revalidate-tag-issues-reproduction
To Reproduce
pnpm build
&pnpm start
http://localhost:3000/
/api/time
, displayed on the landing page, and cached for 60 seconds with the tagtime
.revalidateTag('time')
./api/time
and display the new value.Issue
This workflow works as expected in
next@14.2.10
and below, but in versions above14.2.10,
includingnext@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 therevalidateTag('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
revalidateTag()
within a POST server action, the time is revalidated as expected.The text was updated successfully, but these errors were encountered: