Skip to content

fix(web): redirect from the authentication wrapper after render - #10290

Open
ysalitrynskyi wants to merge 1 commit into
makeplane:previewfrom
ysalitrynskyi:fix/auth-wrapper-redirect-loop
Open

ysalitrynskyi wants to merge 1 commit into
makeplane:previewfrom
ysalitrynskyi:fix/auth-wrapper-redirect-loop

Conversation

@ysalitrynskyi

@ysalitrynskyi ysalitrynskyi commented Nov 15, 2026 •

Copy link
Copy Markdown

Description

Fixes #10289.

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.

References

Summary by CodeRabbit

  • Bug Fixes
    • 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.

Copilot AI balanced review requested due to automatic review settings November 15, 2026 13:06
@CLAassistant

CLAassistant commented Nov 15, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to 14c71

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed [#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 Passed 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 &lt;Redirect&gt;. 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 &lt;Redirect&gt; 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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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.
File Description
apps/​web/​lib/​wrappers/​authentication-wrapper.tsx Moves redirects into an effect to prevent navigation from restarting on every render.

Review effort: Balanced

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
ysalitrynskyi force-pushed the fix/auth-wrapper-redirect-loop branch from 501d3ae to 14c71af Compare November 15, 2026 13:32
@ysalitrynskyi 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: Blank page and endless /meta/ requests after signing in from a work item e-mail link

3 participants