Skip to content

fix: remove login tab sync#9064

Open
csiyang wants to merge 6 commits intomainfrom
siyangcao/nes-1599-log-in-page-confusion-with-non-functional-log-in-button
Open

fix: remove login tab sync#9064
csiyang wants to merge 6 commits intomainfrom
siyangcao/nes-1599-log-in-page-confusion-with-non-functional-log-in-button

Conversation

@csiyang
Copy link
Copy Markdown
Contributor

@csiyang csiyang commented Apr 23, 2026

Summary by CodeRabbit

  • Refactor

    • Removed the login query parameter from sign-in redirects.
    • Sign-in tabs now initialize and update only via user interaction (no URL-driven preselection).
  • Bug Fix / Behavior

    • Sign-in dialog handler simplified to a no-argument callback for both “Log in” and “Create account”.
  • Tests

    • Updated tests to remove login query checks and assert the no-arg handler is invoked exactly once.
  • Documentation

    • Added guidance describing the issue and the applied fix.

@csiyang csiyang self-assigned this Apr 23, 2026
@linear
Copy link
Copy Markdown

linear Bot commented Apr 23, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

Warning

Rate limit exceeded

@csiyang has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 27 minutes and 0 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 27 minutes and 0 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: dbd3e52b-e26d-4862-a6b8-ac9ec2012ef0

📥 Commits

Reviewing files that changed from the base of the PR and between 4822371 and cb9cee7.

📒 Files selected for processing (1)
  • apps/journeys-admin/src/components/SignIn/SignInTabs/SignInTabs.spec.tsx

Walkthrough

Sign-in callbacks no longer accept a login boolean and callers stop sending that query. SignInTabs no longer syncs tab state from the Next.js router and instead relies on local state via the Tabs onChange handler. Tests and redirects were updated accordingly.

Changes

Cohort / File(s) Summary
SignInTabs Component
apps/journeys-admin/src/components/SignIn/SignInTabs/SignInTabs.tsx
Removed router-query-driven initialization/synchronization of tab state. tabValue is now controlled only by the Tabs onChange handler; router-dependent effect/import removed.
AccountCheckDialog Component & Tests
libs/journeys/ui/src/components/TemplateView/AccountCheckDialog/AccountCheckDialog.tsx, libs/journeys/ui/src/components/TemplateView/AccountCheckDialog/AccoutCheckDialog.spec.tsx
Changed AccountCheckDialogProps.handleSignIn from (login: boolean) => void to () => void. Both dialog buttons call handleSignIn() with no args. Tests reset the mock before each test and assert a single call.
CreateJourneyButton Component & Tests
libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.tsx, libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.spec.tsx
handleSignIn no longer appends login to the users/sign-in redirect query. Redirect query now contains only redirect (and conditional createNew=true); tests updated accordingly.
UseThisTemplateButton Component & Tests
libs/journeys/ui/src/components/TemplateView/UseThisTemplateButton/UseThisTemplateButton.tsx, libs/journeys/ui/src/components/TemplateView/UseThisTemplateButton/UseThisTemplateButton.spec.tsx
Removed login argument and login query field from sign-in redirect construction; createNew=true behavior preserved. Tests updated to expect reduced query shape.
Documentation
docs/solutions/ui-bugs/mui-tabs-snapping-to-first-tab-router-sync.md
Added documentation describing the MUI Tabs snapping issue, root cause (router-driven tab resets), the applied fixes (local tab state, handler signature change, removal of login query), and updated test notes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: remove login tab sync' is concise and directly describes the main change: removing the router-dependent useEffect that was syncing the active tab via login query parameters.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch siyangcao/nes-1599-log-in-page-confusion-with-non-functional-log-in-button

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Apr 23, 2026

🤖 Nx Cloud AI Fix Eligible

An automatically generated fix could have helped fix failing tasks for this run, but Self-healing CI is disabled for this workspace. Visit workspace settings to enable it and get automatic fixes in future runs.

To disable these notifications, a workspace admin can disable them in workspace settings.


View your CI Pipeline Execution ↗ for commit 0121652

Command Status Duration Result
nx run journeys-e2e:e2e ❌ Failed 36s View ↗
nx run journeys-admin-e2e:e2e ✅ Succeeded 28s View ↗
nx run watch-e2e:e2e ✅ Succeeded 22s View ↗
nx run resources-e2e:e2e ✅ Succeeded 16s View ↗
nx run videos-admin-e2e:e2e ✅ Succeeded 4s View ↗
nx run-many --target=vercel-alias --projects=watch ✅ Succeeded 2s View ↗
nx run-many --target=vercel-alias --projects=re... ✅ Succeeded 2s View ↗
nx run-many --target=vercel-alias --projects=jo... ✅ Succeeded 2s View ↗
Additional runs (12) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2026-04-24 01:59:02 UTC

@github-actions github-actions Bot temporarily deployed to Preview - resources April 23, 2026 02:07 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys-admin April 23, 2026 02:07 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - watch April 23, 2026 02:07 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys April 23, 2026 02:07 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - videos-admin April 23, 2026 02:07 Inactive
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 23, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys ✅ Ready journeys preview Fri Apr 24 13:55:36 NZST 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 23, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
videos-admin ✅ Ready videos-admin preview Fri Apr 24 13:55:28 NZST 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 23, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
resources ✅ Ready resources preview Fri Apr 24 13:55:42 NZST 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 23, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
watch ✅ Ready watch preview Fri Apr 24 13:55:45 NZST 2026

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
libs/journeys/ui/src/components/TemplateView/AccountCheckDialog/AccountCheckDialog.tsx (1)

54-71: Optional: pass handleSignIn directly.

Now that both buttons invoke the same no-arg callback, the () => handleSignIn() wrapper can be simplified to onClick={handleSignIn} (MUI Button's MouseEvent arg will simply be ignored by a () => void handler).

♻️ Proposed simplification
-            onClick={() => handleSignIn()}
+            onClick={handleSignIn}
...
-            onClick={() => handleSignIn()}
+            onClick={handleSignIn}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@libs/journeys/ui/src/components/TemplateView/AccountCheckDialog/AccountCheckDialog.tsx`
around lines 54 - 71, Both MUI Buttons in AccountCheckDialog currently use an
unnecessary arrow wrapper on the click handler; replace onClick={() =>
handleSignIn()} with onClick={handleSignIn} on the Button elements (the
startIcon/props stay the same) so the no-arg callback handleSignIn is passed
directly and avoids creating extra closures.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@libs/journeys/ui/src/components/TemplateView/AccountCheckDialog/AccountCheckDialog.tsx`:
- Around line 54-71: Both MUI Buttons in AccountCheckDialog currently use an
unnecessary arrow wrapper on the click handler; replace onClick={() =>
handleSignIn()} with onClick={handleSignIn} on the Button elements (the
startIcon/props stay the same) so the no-arg callback handleSignIn is passed
directly and avoids creating extra closures.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e7dce83e-25f0-4726-9abc-84d3a34b1e37

📥 Commits

Reviewing files that changed from the base of the PR and between 4cc30b3 and 508d271.

📒 Files selected for processing (7)
  • apps/journeys-admin/src/components/SignIn/SignInTabs/SignInTabs.tsx
  • libs/journeys/ui/src/components/TemplateView/AccountCheckDialog/AccountCheckDialog.tsx
  • libs/journeys/ui/src/components/TemplateView/AccountCheckDialog/AccoutCheckDialog.spec.tsx
  • libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.spec.tsx
  • libs/journeys/ui/src/components/TemplateView/CreateJourneyButton/CreateJourneyButton.tsx
  • libs/journeys/ui/src/components/TemplateView/UseThisTemplateButton/UseThisTemplateButton.spec.tsx
  • libs/journeys/ui/src/components/TemplateView/UseThisTemplateButton/UseThisTemplateButton.tsx

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 23, 2026

The latest updates on your projects.

Name Status Preview Updated (UTC)
journeys-admin ✅ Ready journeys-admin preview Fri Apr 24 13:55:41 NZST 2026

@blacksmith-sh
Copy link
Copy Markdown
Contributor

blacksmith-sh Bot commented Apr 23, 2026

Found 1 test failure on Blacksmith runners:

Failure

Test View Logs
src/e2e/journeys.spec.ts/journeys View Logs

Fix in Cursor

@github-actions github-actions Bot requested a deployment to Preview - resources April 23, 2026 02:39 Pending
@github-actions github-actions Bot requested a deployment to Preview - videos-admin April 23, 2026 02:39 Pending
@github-actions github-actions Bot requested a deployment to Preview - journeys April 23, 2026 02:39 Pending
@github-actions github-actions Bot requested a deployment to Preview - journeys-admin April 23, 2026 02:39 Pending
@csiyang csiyang requested a review from jianwei1 April 23, 2026 02:41
@github-actions github-actions Bot temporarily deployed to Preview - resources April 23, 2026 02:43 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys April 23, 2026 02:43 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - videos-admin April 23, 2026 02:43 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - watch April 23, 2026 02:43 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys-admin April 23, 2026 02:43 Inactive
Copy link
Copy Markdown
Contributor

@jianwei1 jianwei1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review summary

Nice, focused fix — the useEffect([router]) root cause is called out cleanly and the callback simplification propagates nicely through callers + tests. No blocking issues. Posting as a comment review; a few items to consider before merge (see inline).

Concerns:

  • No regression test for the reported bug — the solution doc itself lists the two tests that would guard it.
  • Solution doc frontmatter (components:) and prose reference wrong paths for AccountCheckDialog / CreateJourneyButton / UseThisTemplateButton (they live under libs/journeys/ui/src/components/TemplateView/, not apps/journeys-admin/src/components/).
  • onChange handler went from named handleTabChange to an inline anonymous arrow — minor backslide vs apps/journeys-admin/AGENTS.md "event handlers prefix with handle".
  • AccountCheckDialog "Login with my account" no longer pre-selects the Log In tab — intentional per the doc, but worth confirming with product/QA on NES-1599 so it isn't later flagged as a regression.

FYI: Playwright E2E (journeys) failed on this run — likely unrelated, worth a re-run before merge.

Comment thread apps/journeys-admin/src/components/SignIn/SignInTabs/SignInTabs.tsx Outdated
- SignInTabs: extract named handleTabChange function
- AccountCheckDialog: simplify onClick to onClick={handleSignIn}
- AccoutCheckDialog.spec: drop redundant toHaveBeenCalledWith() assertions
- SignInTabs.spec: add regression tests for tab stability after re-render
- Solution doc: correct component paths in frontmatter and Investigation prose
@github-actions github-actions Bot temporarily deployed to Preview - resources April 24, 2026 01:16 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - watch April 24, 2026 01:16 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - videos-admin April 24, 2026 01:16 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys April 24, 2026 01:16 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys-admin April 24, 2026 01:16 Inactive
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
apps/journeys-admin/src/components/SignIn/SignInTabs/SignInTabs.spec.tsx (1)

22-41: Good regression coverage for local tab state.

These two re-render tests correctly guard against a regression where a router-driven effect could reset the selected tab. Since rerender re-invokes the component (and thus any useEffects), a reintroduction of the old router.query-syncing effect would make these tests fail, which is exactly the behavior you want to lock in.

One small observation: the two cases are functionally equivalent (a single rerender already re-runs effects just as well as three consecutive ones), so the second test doesn't add much signal beyond the first. If you want to preserve both intents, consider collapsing them or explicitly simulating the scenario the second test is named after (e.g., a shallow route update) — otherwise the "repeated re-renders" case is essentially a duplicate. Non-blocking.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/journeys-admin/src/components/SignIn/SignInTabs/SignInTabs.spec.tsx`
around lines 22 - 41, The two tests in SignInTabs.spec.tsx ("should retain tab
selection after re-render (regression: router effect reset)" and "should not
reset tab selection on repeated re-renders (regression: shallow route update)")
are functionally duplicate because repeated rerender() already re-runs effects;
either remove the second test or replace it to explicitly simulate a shallow
route update: keep the first test as-is using render/ fireEvent/ rerender on
SignInTabs, and for the second test mock the router (next/router) and perform a
shallow route update (e.g., call router.replace or update router.query with
shallow: true or dispatch the appropriate router event) then assert the selected
tab remains "Log In" so the test actually verifies router-driven shallow updates
rather than redundant rerenders.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/journeys-admin/src/components/SignIn/SignInTabs/SignInTabs.spec.tsx`:
- Around line 22-41: The two tests in SignInTabs.spec.tsx ("should retain tab
selection after re-render (regression: router effect reset)" and "should not
reset tab selection on repeated re-renders (regression: shallow route update)")
are functionally duplicate because repeated rerender() already re-runs effects;
either remove the second test or replace it to explicitly simulate a shallow
route update: keep the first test as-is using render/ fireEvent/ rerender on
SignInTabs, and for the second test mock the router (next/router) and perform a
shallow route update (e.g., call router.replace or update router.query with
shallow: true or dispatch the appropriate router event) then assert the selected
tab remains "Log In" so the test actually verifies router-driven shallow updates
rather than redundant rerenders.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1ade6a4d-c97a-400c-928f-d61c7aad078f

📥 Commits

Reviewing files that changed from the base of the PR and between 1fd2621 and 4822371.

📒 Files selected for processing (5)
  • apps/journeys-admin/src/components/SignIn/SignInTabs/SignInTabs.spec.tsx
  • apps/journeys-admin/src/components/SignIn/SignInTabs/SignInTabs.tsx
  • docs/solutions/ui-bugs/mui-tabs-snapping-to-first-tab-router-sync.md
  • libs/journeys/ui/src/components/TemplateView/AccountCheckDialog/AccountCheckDialog.tsx
  • libs/journeys/ui/src/components/TemplateView/AccountCheckDialog/AccoutCheckDialog.spec.tsx
✅ Files skipped from review due to trivial changes (2)
  • libs/journeys/ui/src/components/TemplateView/AccountCheckDialog/AccoutCheckDialog.spec.tsx
  • docs/solutions/ui-bugs/mui-tabs-snapping-to-first-tab-router-sync.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/journeys-admin/src/components/SignIn/SignInTabs/SignInTabs.tsx

@csiyang
Copy link
Copy Markdown
Contributor Author

csiyang commented Apr 24, 2026

Regression tests: Added two tests in SignInTabs.spec.tsx: one verifying the tab stays selected after a re-render, and one verifying stability across repeated re-renders (simulating what a shallow route update would previously have triggered).

Tab pre-selection change: Confirmed intentional — documented in the solution doc as a deliberate tradeoff. The tabs don't change the underlying sign-in flow (real branching happens post-email-submit via fetchSignInMethodsForEmail), so the snap-back fix is the higher-priority UX win.

@csiyang csiyang requested a review from jianwei1 April 24, 2026 01:26
Comment thread apps/journeys-admin/src/components/SignIn/SignInTabs/SignInTabs.spec.tsx Outdated
@csiyang csiyang requested a review from jianwei1 April 24, 2026 01:48
@github-actions github-actions Bot temporarily deployed to Preview - journeys-admin April 24, 2026 01:49 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - resources April 24, 2026 01:49 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - videos-admin April 24, 2026 01:49 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - watch April 24, 2026 01:49 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys April 24, 2026 01:49 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - videos-admin April 24, 2026 01:53 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys April 24, 2026 01:53 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - resources April 24, 2026 01:53 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - journeys-admin April 24, 2026 01:53 Inactive
@github-actions github-actions Bot temporarily deployed to Preview - watch April 24, 2026 01:53 Inactive
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.

2 participants