-
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
is not busting client segment cache
#50203
Comments
Also seeing this behaviour which basically makes |
Yes, this is a painful bug and I believe it has led to a large part of the noise around next link cache invalidation on this issue: |
Here's a video from the CodeSandbox demo in the description - interestingly it also sometimes succeeds 🤔 (I had it succeed multiple times before I took the video, so I thought that was actually not a problem anymore) Kapture.2023-06-14.at.15.41.45.mp4This is where the
"use server";
import { revalidatePath } from 'next/cache'
import { getItemsRepository } from "../_item/ItemsRepository";
export async function saveItemName(itemId: string, newName: string) {
console.log(`SAVE: ${itemId}/${JSON.stringify(newName)}`);
await getItemsRepository().updateItemName(itemId, newName);
revalidatePath(`/${itemId}`);
revalidatePath("/");
} |
Just upgraded to CodeSandbox demo with updated latest canary version: https://codesandbox.io/p/sandbox/charming-benji-68kx5w?file=%2Fpackage.json%3A11%2C27 And now I cannot reproduce the problem you described in the issue anymore @abuinitski (see video below) @abuinitski can you confirm that the latest canary version Kapture.2023-06-14.at.16.35.09.mp4 |
Thanks @karlhorky I believe that this is fixed with #50848. |
yep, it works, thanks! |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
Operating System: Platform: linux Arch: x64 Version: #22 SMP Tue Jan 10 18:39:00 UTC 2023 Binaries: Node: 16.17.0 npm: 8.15.0 Yarn: 1.22.19 pnpm: 7.1.0 Relevant packages: next: 13.4.4-canary.2 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 4.9.5
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true)
Link to the code that reproduces this issue or a replay of the bug
https://codesandbox.io/p/sandbox/cranky-lovelace-mkjcpq
To Reproduce
Describe the Bug
When Server Action triggers server mutation, and properly(?) invalidates obsolete paths, while these paths are (assumedly) removed from server cache, may still remain in client segment cache, and therefore serve incorrect data afterwards.
Expected Behavior
Since Server Action invalidated path, displaying cached version is not expected afterwards.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: