Cancel Rendering Route Error when Router Push from Hash #36830
Labels
bug
Issue was opened via the bug report template.
Navigation
Related to Next.js linking (e.g., <Link>) and navigation.
Verify canary release
Provide environment information
What browser are you using? (if relevant)
Google Chrome Version 101.0.4951.54 (Official Build) (arm64)
How are you deploying your application? (if relevant)
Locally and Vercel
Describe the Bug
We have a hash based modal system. When a modal is opened using...
...and quickly closed with...
...the modal is closed, but we get the error
Error: Cancel rendering route
.Expected Behavior
The modal closes without the error.
To Reproduce
Source
Vercel
https://hashes-two.vercel.app/
Steps locally
There's various combinations, but the shortest is to:
Steps on Vercel
Comment from icyJoseph (https://github.com/icyJoseph)
It seems that any navigation to another route, followed by a hash navigation and a navigation away to another route triggers this. I think the key issue, at least on my setup, is the synchronous call to router.push, twice, once as a hash, and then as a route. Odd, that one must first navigate away, and come back to the page.
Though, I'd expect router.push("#hash").then(() => router.push("/route")) to help out, but it doesn't.
The event listener for errors also does nothing. Curious.
The text was updated successfully, but these errors were encountered: