9fb775e2f8
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 |
||
---|---|---|
.. | ||
app | ||
pages | ||
middleware.js | ||
navigation.test.ts | ||
next.config.js |