Skip to content

refactor(ui): Shared sign-in hooks + snapshot test helper#8652

Draft
alexcarpenter wants to merge 3 commits into
mainfrom
improve-ui-testability
Draft

refactor(ui): Shared sign-in hooks + snapshot test helper#8652
alexcarpenter wants to merge 3 commits into
mainfrom
improve-ui-testability

Conversation

@alexcarpenter
Copy link
Copy Markdown
Member

@alexcarpenter alexcarpenter commented May 26, 2026

Summary

  • Extract sign-in start business logic into a pure reducer (existing POC)
  • Extract duplicated status-routing and error-handling from 8 sign-in sub-cards into 3 shared hooks: useHandleFirstFactorResult, useHandleSecondFactorResult, useHandleUserLockedError
  • Add renderForSnapshot test helper with minimal provider stack for future snapshot tests
  • Net reduction of ~136 lines across sub-cards with zero behavioral change

Test plan

  • All 1886 existing tests pass
  • Zero TypeScript errors in modified files
  • Manual smoke: complete sign-in flows (password, email code, passkey, backup code, email link) end-to-end

Stack: PR 1 of 4 — Foundation. PRs 2-4 build on these shared hooks to make sub-cards prop-driven and add snapshot tests.

🤖 Generated with Claude Code

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 26, 2026

🦋 Changeset detected

Latest commit: 0d98370

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@vercel
Copy link
Copy Markdown

vercel Bot commented May 26, 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 May 26, 2026 10:13pm

Request Review

alexcarpenter and others added 2 commits May 26, 2026 18:12
Deduplicate status-routing and error-handling logic from 8 sign-in
sub-cards into three shared hooks: useHandleFirstFactorResult,
useHandleSecondFactorResult, and useHandleUserLockedError. Also adds
a lightweight renderForSnapshot test helper for future snapshot tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alexcarpenter alexcarpenter changed the title refactor(ui): Extract sign-in start business logic into a pure reducer refactor(ui): Shared sign-in hooks + snapshot test helper May 26, 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.

1 participant