Skip to content

fix(ui): Skip strategy selection screen if it's the only available on setup mfa session task#7760

Open
octoper wants to merge 1 commit intomainfrom
vaggelis/directly-selct-mfa-strategy-if-its-the-last-one
Open

fix(ui): Skip strategy selection screen if it's the only available on setup mfa session task#7760
octoper wants to merge 1 commit intomainfrom
vaggelis/directly-selct-mfa-strategy-if-its-the-last-one

Conversation

@octoper
Copy link
Member

@octoper octoper commented Feb 4, 2026

Description

Only phone number enabled

CleanShot.2026-02-04.at.15.50.15.mp4

Only TOTP enabled

CleanShot.2026-02-04.at.15.51.04.mp4

Both enabled

CleanShot.2026-02-04.at.15.50.15.mp4

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@vercel
Copy link

vercel bot commented Feb 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Feb 4, 2026 1:48pm

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 4, 2026

🦋 Changeset detected

Latest commit: 7961aec

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@clerk/ui Patch
@clerk/chrome-extension Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the core-3 label Feb 4, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 4, 2026

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7760

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7760

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7760

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7760

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7760

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7760

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@7760

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7760

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7760

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7760

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7760

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7760

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7760

@clerk/react

npm i https://pkg.pr.new/@clerk/react@7760

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7760

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7760

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7760

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7760

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7760

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7760

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7760

commit: 7961aec

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 4, 2026

📝 Walkthrough

Walkthrough

This change introduces logic to skip the MFA strategy selection screen when only one strategy is available in the setup MFA task. A new constant defines wizard step mappings for start, phone code, and TOTP flows. The default step is computed dynamically based on enabled second factors: if multiple factors exist, the wizard starts at the selection screen; otherwise it proceeds directly to the appropriate flow. Correspondingly, test coverage was expanded to exercise both single and multiple MFA factor scenarios, with fixtures adjusted to validate conditional navigation and UI rendering aligned with available factors.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: skipping the strategy selection screen when only one MFA strategy is available, which matches the core objective of the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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


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

Copy link
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.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@packages/ui/src/components/SessionTasks/tasks/TaskSetupMfa/index.tsx`:
- Around line 47-51: The wizard currently computes defaultStep and may jump to
the TOTP flow even when secondFactorsAvailableToAdd is empty; update the logic
so defaultStep and the useWizard call first check for an empty
secondFactorsAvailableToAdd and in that case set defaultStep to
WIZARD_STEPS.start (or trigger an explicit error state), otherwise pick
phoneCode or totp only if those factors actually exist; modify the computation
around defaultStep and the useWizard({ defaultStep: ... }) invocation
(referencing secondFactorsAvailableToAdd, defaultStep, useWizard, and
WIZARD_STEPS) to guard against length === 0 and avoid routing to unavailable
flows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant