48bad4e894
### What When the popstate action is fired (as is the case in a browser back button), if the page you're going back to has missing cache node data, the router will crash. ### Why Almost all router actions will suspend at the app-router level with the exception of `ACTION_RESTORE`. This was to address an issue where suspending in the router would add enough delay for browser scroll restoration behavior not to work. As a result, when going back to the page with missing data, app-router wouldn't suspend but layout-router would suspend on the missing data while triggering a lazy fetch. We trigger a server-patch with the applied lazy data, but when React replays the render, it will replay the branch without the cache node data applied. This results in the router getting caught in a loop of suspending, applying the cache node, replaying the branch without the cache node, and eventually crashing due to an error thrown by React to prevent re-suspending indefinitely. ### How This adds a property to the cache node to signal if the lazy data has been resolved. If it has been, we won't call the server patch action again. Fixes #61336 Closes NEXT-2438 |
||
---|---|---|
.. | ||
app | ||
pages | ||
middleware.js | ||
navigation.test.ts | ||
next.config.js |