Skip to content

Add username selection step to email signup flow - #2505

Merged
MusabShakeel576 merged 1 commit into
masterfrom
claude/account-creation-onboarding-xvw63f
Sep 10, 2026
Merged

Add username selection step to email signup flow#2505
MusabShakeel576 merged 1 commit into
masterfrom
claude/account-creation-onboarding-xvw63f

Conversation

@MusabShakeel576

Copy link
Copy Markdown
Contributor

Summary

Introduces a new username selection step in the email-first signup flow, allowing users to choose their own username instead of having one automatically derived from their email address.

Key Changes

  • New Username Step Component (app/signup/username.tsx): Implements a full-featured username selection screen with:

    • Real-time format validation as the user types
    • Debounced availability checking (400ms) to avoid excessive API calls
    • Separate validation on submit to catch race conditions
    • Mobile and desktop responsive layouts
    • Clear error messaging and availability feedback
    • Pre-population from previously chosen username or email-derived suggestion
  • Username Utilities (lib/utils/username.ts + tests): Provides validation and formatting functions:

    • normalizeUsername(): Lowercases and trims for consistent storage
    • sanitizeUsernameInput(): Real-time keystroke cleanup (lowercasing, character filtering, length limiting)
    • getUsernameFormatError(): Format validation (length, allowed characters)
    • isUsernameTakenError(): Distinguishes username conflicts from other signup failures
    • suggestUsernameFromEmail(): Derives initial suggestion from verified email
  • API Integration (lib/api.ts):

    • New checkUsernameAvailability() endpoint to validate username availability
    • Updated emailSignUp() to accept optional username parameter
    • Enhanced error handling to surface server validation messages
  • State Management (store/useSignupFlowStore.ts):

    • Added username field to signup flow state
    • Added setUsername() action
    • Updated step order: emailotpusernamepasskeycreatingcomplete
  • UI Component Enhancement (components/ui/input.tsx):

    • Added prefix prop to support fixed content (e.g., "@" symbol) inside input fields
    • Wrapper pattern for prefix support maintains consistent styling
  • Flow Updates:

    • Updated app/signup/otp.tsx to route to username step instead of passkey
    • Updated app/signup/passkey.tsx back button to return to username step
    • Updated app/signup/creating.tsx to handle missing username and route back if needed
    • Shared review access accounts skip the username step (they keep their existing handle)
  • Tracking & Navigation:

    • Added username-related tracking events: USERNAME_STEP_VIEWED, USERNAME_SUBMITTED, USERNAME_UNAVAILABLE
    • Added SIGNUP_USERNAME path constant
    • Updated signup layout to include username route

Notable Implementation Details

  • Debounced Availability Check: Waits 400ms after typing stops before checking availability, reducing API load while providing feedback before the user clicks Continue
  • Dual Validation: Format validation happens immediately; availability is checked both during typing (debounced) and on submit (to catch race conditions)
  • Graceful Degradation: If availability check fails due to network issues, the form doesn't block—the server validates again during account creation
  • Shared Review Access: Existing reviewer accounts bypass this step entirely, maintaining their current usernames
  • Resume Support: If a user returns to signup, their previously chosen username is restored

https://claude.ai/code/session_01XyNemE6Ss9mG2t2UXYVnNV

The handle other people see was assigned from the email prefix, never
chosen. Onboarding now asks for it, between OTP verification and the
push-notification prompt.

The field seeds from the email prefix — the name the account would have
been given automatically — so the common case is one tap, and it seeds
from an already-chosen handle when the flow is resumed. Input is
sanitised per keystroke to what a handle may contain, availability is
checked once typing settles, and again on Continue because the
debounced answer may be stale or may never have run on a slow
connection. A check that cannot reach the server does not block the
step: account creation validates the name again and is the real gate.

Paths that must not change, and do not:
- The shared review account already exists and keeps its own handle, so
  it skips this step exactly as it skips the passkey one.
- Login, recovery and passkey creation are untouched; only the passkey
  screen's back marker moves to the new previous step.
- The chosen handle is omitted from the signup request when absent, so
  the server still derives one — which is also what happens if this
  build reaches a backend without the step.

A handle claimed between the check and account creation now returns the
user to this step rather than to the passkey they already created, so
`emailSignUp` surfaces the server's reason instead of throwing the raw
response — which also means real failures reach the user in place of
the generic "Failed to create account".

`Input` gains an optional `prefix` for the "@" inside the field. With
no prefix the rendered classes are unchanged, so every existing field
is untouched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XyNemE6Ss9mG2t2UXYVnNV
@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

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

2 Skipped Deployments
Project Deployment Actions Updated
solid-app Ignored Ignored Sep 10, 2026 11:48am UTC
solid-app-staging Ignored Ignored Sep 10, 2026 11:48am UTC

Request Review

@claude

claude Bot commented Sep 10, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.


Additional checks performed:

  • Debugging leftovers (console.log, debugger statements)
  • Commented-out code blocks
  • Test/scaffolding artifacts (TODO/FIXME, .only/.skip)
  • Hardcoded secrets or local config
  • Accidental/unrelated edits

All clear.

@MusabShakeel576
MusabShakeel576 merged commit 465ecdb into master Sep 10, 2026
5 checks passed
@MusabShakeel576
MusabShakeel576 deleted the claude/account-creation-onboarding-xvw63f branch September 10, 2026 12:09
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