Repository navigation
Conversation
A navigation whose dynamic RSC never settles wrote a pending thenable into the BFCache. With staleTimes.dynamic > 0, later clicks reused that entry with needsDynamicRequest: false, so the route stayed dead until staleAt with zero network. Skip unsettled BFCache entries on regular navigations and do not adopt in-flight prefetch thenables as prefetchRsc. Fixes vercel#98066
Assert the later click from a fresh page after the network is restored, so a poisoned BFCache entry is the thing under test. Without the fix this click issues zero requests; with it the navigation commits.
Owner
Author
|
Closing this as part of a cleanup of my stale/slow-moving PRs. Thanks for your time! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A stalled dynamic RSC request could permanently kill soft navigation to that route. With
experimental.staleTimes.dynamic > 0, later clicks issued zero requests untilstaleAtexpired, becausewriteToBFCachestored a never-settlingrscthenable andreadFromBFCacheDuringRegularNavigationserved it withneedsDynamicRequest: false.This change:
prefetchRsc(React'suseDeferredValueparks on that thenable; a hung prefetch then blocked later successful dynamic responses)Fixes vercel#98066
Related: vercel#97807, vercel#97036, vercel#96233. vercel#97815 only adds an MPA fallback when
navigateToUnknownRouterejects; it does not evict a poisoned BFCache entry, so this is not a second closer for the same bug.Upstream PR (into vercel/next.js): vercel#98087
Verification
Command:
Failing without the
render-tree.tschange (canary client, same test):The later click from
/otherissued zero RSC requests — the poisoned BFCache entry was served withneedsDynamicRequest: false.Passing with the fix: