rsnext/test/e2e/app-dir/navigation
Zack Tanner 48bad4e894
fix router crash on revalidate + popstate (#62383)
### 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
2024-02-27 10:15:36 -08:00
..
app fix router crash on revalidate + popstate (#62383) 2024-02-27 10:15:36 -08:00
pages memoize useParams (#56771) 2023-10-13 07:47:05 +00:00
middleware.js Export RedirectType from next/navigation (#54729) 2023-08-29 11:05:44 -07:00
navigation.test.ts fix router crash on revalidate + popstate (#62383) 2024-02-27 10:15:36 -08:00
next.config.js Remove experimental config from create-next-app (#49241) 2023-05-05 00:22:28 -07:00