-
Notifications
You must be signed in to change notification settings - Fork 26.1k
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
revalidatePath
with type = "layout" | "page"
does not invalidate the data cache
#62071
Comments
Can confirm this is happening for me as well, running 14.1.0. Trying to revalidate the root layout in my case does not trigger revalidation of sub paths. |
not working for me. I have to either manually refersh or use |
I faced a similar issue while using revalidatePath on a dynamic route and specifying "page" or "layout" as the type. When I omitted the second argument in revalidatePath, the cache was revalidated. Using 14.2.1 |
Same thing here on my side, using revalidatePath with |
Hi @juliesaia -- it looks like there might be some confusion from the docs around how the I've submitted a PR that attempts to clarify it. When you call For your dynamic segment, the possible cache tags are |
When revalidating a page that corresponds with a dynamic path and when using the “type” parameter, eg `revalidatePath(“/dynamic/1”, “page”)` corresponding with `/dynamic/[id]`, the wrong cache tags would be checked to determine if a revalidation occurred. This is because the “derived” cache tags created for a `/dynamic/[id]/page` are: - /dynamic/[id]/layout - /dynamic/[id]/page Additionally, a tag is added for the current canonical URL, so the final tag would be: - /dynamic/1 Thus a fetch on `/dynamic/1` would be tagged with the following: - /layout - /dynamic/layout - /dynamic/[id]/layout - /dynamic/[id]/page - /dynamic/1 Calling `revalidatePath(“/dynamic/1”, “page”)` would signal to revalidate caches tagged `/dynamic/1/page` in the current logic. However, this tag doesn’t exist given the above, so it would be a no-op and wouldn't properly re-invoke the fetch. This updates the docs to explicitly call out that if you are attempting to revalidate a path that corresponds with a dynamic page, that you should not provide a "type" argument. Fixes #62071 Closes NEXT-3302
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/juliesaia/revalidate-path-test
To Reproduce
Current vs. Expected behavior
revalidatePath("/dynamic/1", "layout")
should invalidate the cached result fromfetch
. Without this functionality, it's impossible to invalidate a subset of paths.Provide environment information
Operating System: Platform: linux Arch: x64 Version: #1 SMP Thu Oct 5 21:02:42 UTC 2023 Binaries: Node: 20.11.0 npm: 10.2.4 Yarn: N/A pnpm: N/A Relevant Packages: next: 14.1.1-canary.54 // Latest available version is detected (14.1.1-canary.54). eslint-config-next: 14.1.0 react: 18.2.0 react-dom: 18.2.0 typescript: 5.3.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
App Router
Which stage(s) are affected? (Select all that apply)
next dev (local), next start (local), Vercel (Deployed)
Additional context
No response
NEXT-3302
The text was updated successfully, but these errors were encountered: