Skip to content

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

Merged
octoper merged 1 commit intomainfrom
vaggelis/directly-selct-mfa-strategy-if-its-the-last-one
Feb 6, 2026
Merged

fix(ui): Skip strategy selection screen if it's the only available on setup mfa session task#7760
octoper merged 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:

Summary by CodeRabbit

  • New Features
    • Streamlined MFA setup flow: when only one authentication method is available, the strategy selection screen is now automatically skipped, allowing users to proceed directly to configuring their chosen method.

@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 6, 2026 9:35am

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 4, 2026

🦋 Changeset detected

Latest commit: 81b341a

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: 81b341a

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 4, 2026

📝 Walkthrough

Walkthrough

The change adds a WIZARD_STEPS constant and updates wizard initialization for TaskSetupMfa: the default step is computed (phoneCode if phone_code available, otherwise totp), and the wizard now starts at the selection screen only when multiple second factors are available; when only one strategy exists it skips to that flow. Tests were expanded and refactored to cover single- and multi-factor scenarios and the resulting UI/navigation behavior.

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

✏️ 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.

@octoper octoper force-pushed the vaggelis/directly-selct-mfa-strategy-if-its-the-last-one branch from 7961aec to 81b341a Compare February 6, 2026 09:34
@octoper octoper merged commit 4704dfd into main Feb 6, 2026
66 of 68 checks passed
@octoper octoper deleted the vaggelis/directly-selct-mfa-strategy-if-its-the-last-one branch February 6, 2026 12:52
nikosdouvlis pushed a commit that referenced this pull request Feb 12, 2026
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.

2 participants

Comments