-
Notifications
You must be signed in to change notification settings - Fork 13
[TASK-16676] fix: Request pots redirect #1420
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Inconsistent redirect methods break SPA experience and may degrade performance.
This change introduces full page reloads (
window.location.assign) for external/stored redirects while maintaining client-side navigation (router.push) for the fallback home route. This inconsistency raises several concerns:Performance & UX Impact: Full page reloads are significantly slower than client-side navigation and force users through a complete re-initialization (loading states, context setup, state reset).
State Loss: All React state, context, and in-memory data will be lost with
window.location.assign(), potentially disrupting user workflows or requiring data refetch.SPA Benefits: This breaks the single-page application experience that Next.js provides, which is one of its core advantages.
Inconsistency: If full page reloads are necessary for
redirect_uriandlocalStorageRedirectcases, why is the fallback home route still using client-side navigation? This suggests either:Based on the PR title "fix: Request pots redirect", this appears to be addressing a specific redirect issue. Please clarify:
router.push()withrouter.refresh()to reload server state?window.history.replaceStateif URL synchronization is the concern (consistent with learnings)?🏁 Script executed:
Length of output: 27
Length of output: 6228
🏁 Script executed:
Length of output: 1947
🏁 Script executed:
Length of output: 5246
Length of output: 849
🏁 Script executed:
Length of output: 7487
🏁 Script executed:
Length of output: 59
Replace
window.location.assign()withrouter.push()for consistency and to preserve SPA experience.The validated redirect URLs are same-origin only (enforced by
sanitizeRedirectURL), so they don't require full page reloads. Other parts of the codebase handle identical validated redirects differently:SetupPasskey.tsxline 62:router.push(validRedirectUrl)Landing.tsxline 30:push(sanitizedRedirectUrl)Welcome.tsxline 29:push(sanitizedRedirectUrl)Using
window.location.assign()unnecessarily reloads the entire page for internal navigation, destroying React state, context, and degrading perceived performance. This also creates an inconsistency withinuseLogin.tsxitself: line 42 correctly usesrouter.push('/home')for the fallback.Change lines 36 and 40 from
window.location.assign(validRedirectUrl)torouter.push(validRedirectUrl)to match the established pattern. If server state refresh is needed after login, considerrouter.push()followed byrouter.refresh().🤖 Prompt for AI Agents