Skip to content

refactor(onboarding): infer step from user state instead of localStorage#3084

Open
baktun14 wants to merge 1 commit intofeat/auth0-verification-frontendfrom
feat/infer-onboarding-step
Open

refactor(onboarding): infer step from user state instead of localStorage#3084
baktun14 wants to merge 1 commit intofeat/auth0-verification-frontendfrom
feat/infer-onboarding-step

Conversation

@baktun14
Copy link
Copy Markdown
Contributor

Why

Remove localStorage-based onboarding step persistence in favor of deriving the current step from actual user data (userId, emailVerified, hasManagedWallet). Stored state could go stale or diverge from reality, causing the stepper to land on the wrong step.

Stacked on #3052. Retarget to main once that merges.

What

  • Add inferStep(user, hasManagedWallet) + deriveCompletedSteps(step) helpers in OnboardingContainer
  • Replace useState for current/completed steps with useMemo derivation
  • Drop localStorage reads/writes from OnboardingContainer, VerifyEmailPage, and AuthService.logout()
  • Delete @src/services/storage/keys.ts (no longer referenced)
  • Add isLoading to onboarding children props; OnboardingView renders a spinner placeholder while data resolves
  • Update tests: mock useUser/usePaymentMethodsQuery with proper {data, isLoading} shape, add coverage for each inferred-step branch

Remove localStorage-based onboarding step persistence and derive the
current step from actual user data (userId, emailVerified, hasManagedWallet).
This eliminates bugs caused by stale or inconsistent stored state.
@baktun14 baktun14 requested a review from a team as a code owner April 20, 2026 22:20
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 20, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • main

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c536d93f-a6f4-4dbd-ae4a-e26d6544bff6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/infer-onboarding-step

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant