rsnext/test/e2e/app-dir/shallow-routing/app
Zack Tanner 5309c30c7d
make router restore action resilient to a missing tree (#62098)
### What
Following an anchor link to a hash param, and then attempting to use
`history.pushState` or `history.replaceState`, would result in an MPA
navigation to the targeted URL.

### Why
In #61822, a guard was added to prevent calling `ACTION_RESTORE` with a
missing tree, to match other call-sites where we do the same. This was
to prevent the app from crashing in the case where app router internals
weren't available in the history state. The original assumption was that
this is a rare / unlikely edge case. However the above scenario is a
very probable case where this can happen, and triggering an MPA
navigation isn't ideal.

### How
This updates `ACTION_RESTORE` to be resilient to an undefined router
state tree. When this happens, we'll still trigger the restore action to
sync params, but use the existing flight router state.

Closes NEXT-2502
2024-02-15 14:10:29 +00:00
..
(shallow) make router restore action resilient to a missing tree (#62098) 2024-02-15 14:10:29 +00:00
layout.tsx Add experimental support for history.pushState and history.replaceState (#58335) 2023-11-13 13:32:08 +00:00
page.tsx Add experimental support for history.pushState and history.replaceState (#58335) 2023-11-13 13:32:08 +00:00