-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
inside dynamic parallel route slot does not work as expected
#64517
Comments
ztanner
added a commit
that referenced
this issue
Apr 16, 2024
When an action is marked as "discarded", we enqueue a refresh, since the navigation event will be invoked immediately without waiting for the action to finish. We refresh because it's possible that the discarded action triggered some sort of mutation/revalidation, and we want the router to still be able to respond to that new data. However there's a bug in this logic -- it'll only enqueue the refresh action if there were no other actions in the queue, ignoring the case where something is still in the queue. This makes sure that the refresh is handled after `runRemainingActions` finishes. When adding a test for the server component case (which doesn't hit this refresh branch), I noticed `LayoutRouter` caused React to suspend indefinitely, because it got stuck in the `use(unresolvedThenable)` case. We should only suspend indefinitely if we kicked off a the `SERVER_PATCH` action, as otherwise it's possible nothing will ever break out of that branch. Fixes #64517 Closes NEXT-3124
ztanner
added a commit
that referenced
this issue
Apr 17, 2024
When an action is marked as "discarded", we enqueue a refresh, since the navigation event will be invoked immediately without waiting for the action to finish. We refresh because it's possible that the discarded action triggered some sort of mutation/revalidation, and we want the router to still be able to respond to that new data. However there's a bug in this logic -- it'll only enqueue the refresh action if there were no other actions in the queue, ignoring the case where something is still in the queue. This makes sure that the refresh is handled after `runRemainingActions` finishes. When adding a test for the server component case (which doesn't hit this refresh branch), I noticed `LayoutRouter` caused React to suspend indefinitely, because it got stuck in the `use(unresolvedThenable)` case. We should only suspend indefinitely if we kicked off a the `SERVER_PATCH` action, as otherwise it's possible nothing will ever break out of that branch. Fixes #64517 Closes NEXT-3124
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Link to the code that reproduces this issue
https://codesandbox.io/p/sandbox/cool-resonance-hmp58x
To Reproduce
/foo
via link (dynamic)Current vs. Expected behavior
The resource associated with the tag has not been updated.
I'm expected the resource to be updated.
Downgrading next to 14.1.0 in the provided example fixes the problem.
This may only apply to the dev server:
Sometimes the resource seems to be updated when a certain time has passed (30sec?), but to me the pattern is random.
You can also sometimes see different cached data between the two routes (I expect this to be because we have a page and a catchall page in the main slot - optional cache all does not work, this is why it's duplicated)
Provide environment information
Operating System: Platform: linux Arch: x64 Version: #1 SMP PREEMPT_DYNAMIC Sun Aug 6 20:05:33 UTC 2023 Available memory (MB): 4102 Available CPU cores: 2 Binaries: Node: 20.9.0 npm: 9.8.1 Yarn: 1.22.19 pnpm: 8.10.2 Relevant Packages: next: 14.2.1 // Latest available version is detected (14.2.1). eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.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)
Additional context
We upgraded our application to 14.2.0 only to see that our revalidation no longer has any effect, but we also can't really downgrade since we before got occosionally/reproducible blank pages that have been fixed in the release.
I'm currently setting
experimental.staleTimes.dynamic
to 0 as a hot-fix, but it's also not helping all of time.We usually have a redirect after the action, but for some other actions the resource is being updated without a redirect afterwards, in these cases it seems that the revalidation works as before.
Our app folder structure is similar as in the provided example this is why I adapted it.
We have a main page that has paginated content and the parallel route slot can render a sidepanel containing additional information where some things can also be updated. Updated data needs to be reflected in the panel as well as the main slot.
The text was updated successfully, but these errors were encountered: