-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server-side redirect from a page with Loading causes double redirect #59800
Comments
I think it's because the strict mode of react is turned on |
@LineGu but that mode is not relevant in production build, is it? |
I've been looking into this issue as well and this is what I came to: In the
This means that what happens is:
For more context, I found this PR that initially implemented injecting the My understanding is that using the That said, I think there should be a mechanism to opt out of this as it results in poor user experience. |
Also experiencing this as well. I noticed that |
@dihmeetree is |
Hmmm it just worked for me @steven-tey (using |
|
### What & Why When an RSC triggers `navigate` after the shell has already been sent to the client, a meta tag is inserted to signal to the browser it needs to perform an MPA navigation. This is primarily used for bot user agents, since we wouldn't have been able to provide a proper redirect status code (since it occurred after the initial response was sent). However, the router would trigger a SPA navigation, while the `<meta>` tag lagged to perform an MPA navigation, resulting in 2 navigations to the same URL. ### How When the client side code attempts to handle the redirect, we treat it like an MPA navigation. This will suspend in render and trigger a `location.push`/`location.replace` to the targeted URL. As a result, only one of these navigation events will win. Fixes #59800 Fixes #62463 Closes NEXT-2952 Closes NEXT-2719
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://github.com/harunsmrkovic/double-redirect-nextjs-repro
To Reproduce
/parent
route/parent/child
routeBildschirmaufnahme.2023-12-20.um.10.42.35.mov
Current vs. Expected behavior
I expected that after moving from Loading screen of Parent route and showing the child route, there will be no more redirects/refreshes done
In other words, I expected that once I land on
/parent/child
route that the timer will start from 0 and just increase, never going back to 0.Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.0.0: Fri Sep 15 14:42:57 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T8112 Binaries: Node: 18.18.2 npm: 9.8.1 Yarn: 1.22.19 pnpm: N/A Relevant Packages: next: 14.0.5-canary.19 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
App Router, Routing (next/router, next/navigation, next/link)
Additional context
I was testing only locally, in Chrome, Safari & Electron (Cypress).
EDIT: It is also reproducible in a production build in a deployed version.
Removing the loading.tsx page from the parent route resolves this issue.
NEXT-2952
The text was updated successfully, but these errors were encountered: