You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(web): redirect from the authentication wrapper after render - #10290
AuthenticationWrapper called router.push() / router.replace() in its render body. Each re-render started a new navigation that interrupted the previous one. When next_path points to a route whose clientLoader waits on the network, no navigation ever finished. That route is /:workspaceSlug/projects/:projectId/issues/:issueId, the link format used in notification e-mails. The page stayed blank on /?next_path=…, and the loader's /meta/ request kept going out.
The redirects now go through a small Redirect component that calls the same router.push() / router.replace() from a useEffect, so each target is navigated to once. The branches and their conditions are unchanged.
Type of Change
Bug fix (non-breaking change which fixes an issue)
Feature (non-breaking change which adds functionality)
Improvement (change that would cause existing functionality to not work as expected)
Code refactoring
Performance improvements
Documentation update
Screenshots and Media (if applicable)
None. The page is blank before the fix; after it, the work item opens.
Test Scenarios
Setup: a production build of apps/web, served with a stub API. The stub answers the user, profile, settings, workspaces and instance endpoints, and answers GET …/issues/<id>/meta/ after 300 ms. A script loaded before the app counts the /meta/ requests the page creates.
Scenario
preview
This branch
Signed out, open /ws/projects/p1/issues/i1
Sign-in page at /?next_path=%2Fws%2Fprojects%2Fp1%2Fissues%2Fi1
Same
Then sign in, back on that /?next_path=…
Blank page that stays there; 1,185 /meta/ requests in 9 s, about 1,400 before the browser refused new requests (net::ERR_INSUFFICIENT_RESOURCES)
1 /meta/ request, then /ws/browse/KEY-1/
Signed in, open / without next_path
not re-tested
Redirects to /ws/
Signed out, open a workspace page
not re-tested
Redirects to /?next_path=…
oxfmt --check, oxlint and check:types for apps/web pass.
Improved navigation across authentication, onboarding, password setup, and workspace flows. Redirects continue to use the existing destinations, and onboarding redirects replace the current history entry, helping prevent users from returning to the previous page with the Back button. Other redirects retain their existing navigation behavior.
No actionable comments were generated in the recent review.
Walkthrough
AuthenticationWrapper now returns redirect components for its existing authentication and onboarding checks. The components perform push or replace navigation in an effect, while preserving the selected destinations and navigation modes.
Changes: Authentication redirects
Layer / File(s)
Summary
Resolve and perform authentication redirects apps/web/lib/wrappers/authentication-wrapper.tsx
The wrapper returns Redirect components for the non-authenticated, onboarding, set-password, and authenticated flows. Redirect performs navigation in an effect, using replace when requested and push otherwise.
This change stops redirects from being triggered on every render, which fixes the blank page and request loop when signing in from a work-item link. It keeps the existing redirect targets and navigation modes, and no concrete merge-blocking risk was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: AuthenticationWrapper redirects move out of render. The title follows the conventional commit style and matches the summary and objectives. It is short, specific, and …
Description check
The description follows the template. It has a Description section that explains the render-time navigation bug and the useEffect fix. The Type of Change section marks Bug fix. The Screenshots section…
Linked Issues check
[#10289] The reported cause is router.push() / router.replace() called during render in AuthenticationWrapper. The reviewed head changes the implementation from the previous review. It adds a `R…
Out of Scope Changes check
The whole-PR diff against the merge base (290383d) changes only apps/web/lib/wrappers/authentication-wrapper.tsx in the reviewed diff. The changes are: the useEffect import, the Redirect compon…
Full details: Title check
Explanation
The title names the main change: AuthenticationWrapper redirects move out of render. The title follows the conventional commit style and matches the summary and objectives. It is short, specific, and clear, so it passes.
Full details: Description check
Explanation
The description follows the template. It has a Description section that explains the render-time navigation bug and the useEffect fix. The Type of Change section marks Bug fix. The Screenshots section explains that the page is blank before the fix. The Test Scenarios section gives a detailed table and lint and type-check results. The References section links #10289. The description is complete and does not need changes.
Full details: Linked Issues check
Explanation
[#10289] The reported cause is router.push() / router.replace() called during render in AuthenticationWrapper. The reviewed head changes the implementation from the previous review. It adds a Redirect component (apps/web/lib/wrappers/authentication-wrapper.tsx) that calls router.replace(to) or router.push(to) inside a useEffect with deps [router, to, replace]. The wrapper no longer calls the router in its render body. The diff against the merge base removes every render-time router call and replaces each with <Redirect>. The branch conditions and redirect targets are unchanged: getWorkspaceRedirectionUrl(), /onboarding, and /?next_path=…. The ONBOARDING branch keeps replace. The previous assessment's resolve() design no longer applies to this head. The current code still addresses the stated cause. The issue asks for behavior and does not request automated tests. The manual production-build results in the PR description were not re-run here, so they are not independently verified.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff against the merge base (290383d) changes only apps/web/lib/wrappers/authentication-wrapper.tsx in the reviewed diff. The changes are: the useEffect import, the Redirect component, removal of the router hook from AuthenticationWrapper, and substitution of <Redirect> elements for the former render-time navigations and empty-fragment returns. All of these serve the objective in #10289. No unrelated files or behavior changes were found. The incremental change since the previous review (501d3ae) is the same file and is within the same objective.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 28db35ab-ec09-4227-bd1f-eec522657047
Commits
Reviewing files that changed from the base of the PR and between 501d3ae and 14c71af.
Files selected for processing: 1
apps/web/lib/wrappers/authentication-wrapper.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
🟢 Approval recommended
No active review issues are reported for the change moving authentication redirects out of render.
No open issues 🎉
What changed in this PR
Fixes #10289 by moving authentication redirects out of render, preventing repeated navigation from interrupting slow route loaders and leaving e-mail work item links on a blank page.
Changes:
Separates render-time content and redirect decisions from navigation.
Executes redirects in a useEffect keyed on the destination, push/replace mode, and router.
Preserves existing authentication conditions, rendered content, and redirect destinations.
AuthenticationWrapper called router.push() during render, so every re-render
started a new navigation that cancelled the previous one. With a next_path
whose clientLoader waits on the network, such as the old work item URL in
notification e-mails, the page stayed blank and the loader's request repeated
endlessly. Redirect from an effect instead, once per target.
ysalitrynskyi
changed the title
fix(web): redirect once from the authentication wrapper, not on every render
fix(web): redirect from the authentication wrapper after render
Nov 15, 2026
This branch has not been deployed
No deployments
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
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.
Description
Fixes #10289.
AuthenticationWrappercalledrouter.push()/router.replace()in its render body. Each re-render started a new navigation that interrupted the previous one. Whennext_pathpoints to a route whoseclientLoaderwaits on the network, no navigation ever finished. That route is/:workspaceSlug/projects/:projectId/issues/:issueId, the link format used in notification e-mails. The page stayed blank on/?next_path=…, and the loader's/meta/request kept going out.The redirects now go through a small
Redirectcomponent that calls the samerouter.push()/router.replace()from auseEffect, so each target is navigated to once. The branches and their conditions are unchanged.Type of Change
Screenshots and Media (if applicable)
None. The page is blank before the fix; after it, the work item opens.
Test Scenarios
Setup: a production build of
apps/web, served with a stub API. The stub answers the user, profile, settings, workspaces and instance endpoints, and answersGET …/issues/<id>/meta/after 300 ms. A script loaded before the app counts the/meta/requests the page creates.preview/ws/projects/p1/issues/i1/?next_path=%2Fws%2Fprojects%2Fp1%2Fissues%2Fi1/?next_path=…/meta/requests in 9 s, about 1,400 before the browser refused new requests (net::ERR_INSUFFICIENT_RESOURCES)/meta/request, then/ws/browse/KEY-1//withoutnext_path/ws//?next_path=…oxfmt --check,oxlintandcheck:typesforapps/webpass.References
Summary by CodeRabbit