-
Notifications
You must be signed in to change notification settings - Fork 27.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make router restore action resilient to a missing tree (#62098)
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. 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. 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
- Loading branch information
Showing
5 changed files
with
68 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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