When using router.replace() from next/navigation for routing, the modal opened with the next.js slot does not close. #71795
Labels
bug
Issue was opened via the bug report template.
create-next-app
Related to our CLI tool for quickly starting a new Next.js application.
Link to the code that reproduces this issue
https://github.com/2dubbing/nextgram
To Reproduce
Current vs. Expected behavior
Current: �If you route with router.replace() while the modal window is open, the modal window will not close.
Expected behavior: Routing with router.replace() should close any open modal windows.
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 24.0.0: Mon Aug 12 20:51:54 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T6000 Available memory (MB): 16384 Available CPU cores: 10 Binaries: Node: 20.18.0 npm: 10.8.2 Yarn: N/A pnpm: 9.6.0 Relevant Packages: next: 15.0.0-canary.61 react: 19.0.0-rc.0 react-dom: 19.0.0-rc.0 typescript: 5.5.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
create-next-app
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
You might want to use router.replace for the following reasons
Because we think it's better for usability to use router.replace rather than router.back if the data change is successful on the Change Form Data page.
thank you.
The text was updated successfully, but these errors were encountered: