Conversation
…rowealth#954) resetFlow() only reset the onboarding-state record, so "Review Onboarding" left the strategy/deposit blobs written by StrategyOverviewStep and FirstDepositStep behind. OnboardingSettings kept its own copy of the clear logic, and the two reset paths had already drifted apart. Add a single resetOnboardingState() helper in the onboarding-state adapter that clears the flow state plus both step-scoped keys via STORAGE_KEYS, and route both reset entry points through it. - onboarding-state.ts: add resetOnboardingState() - useOnboardingFlow: resetFlow() delegates to the shared helper - OnboardingSettings: drop the duplicated partial clear - tests: reset coverage in onboarding-state.test.ts, a new useOnboardingFlow.test.ts regression suite, and the Neurowealth#581 source guard now points at onboarding-state.ts and asserts both paths share the helper
|
@xeexco Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Fix conflicts |
Contributor
|
fix conflict |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR fixes the onboarding flow so every reset path clears the full set of localStorage records the flow owns.
resetFlow()inuseOnboardingFlowpreviously reset only theonboarding-staterecord. The step-scoped blobs written byStrategyOverviewStep(user-strategy) andFirstDepositStep(first-deposit) survived the reset, so "Review Onboarding" dropped the user back to step 0 whilelocalStoragestill held their previous strategy and deposit choices — stale state that could resurface on the next pass through the flow.OnboardingSettingskept its own copy of the clear logic, and the two reset paths had already drifted apart. That duplication is what let the partial reset go unnoticed, so this PR consolidates both entry points onto a single shared helper.Related Issue
Closes #954
Changes
🔁 One shared onboarding reset
[ADD]
src/lib/onboarding-state.ts— newresetOnboardingState()clearOnboardingState().STORAGE_KEYS.ONBOARDING_USER_STRATEGYandSTORAGE_KEYS.ONBOARDING_FIRST_DEPOSIT, sourced from the registry rather than raw literals (keeps the Replace OnboardingSettings' hardcoded localStorage key strings with the storage-keys registry #581 guarantee intact).try/catchwithlogger.error, matching the defensive storage access already used in this adapter.[MODIFY]
src/hooks/useOnboardingFlow.tsresetFlow()now delegates to the shared helper before persisting the fresh in-progress record, so the flow state and the step-scoped keys are always cleared together.[MODIFY]
src/components/settings/OnboardingSettings.tsx🧪 Regression coverage
[ADD]
src/hooks/useOnboardingFlow.test.tsresetFlow()clears the step-scoped strategy/deposit records, still persists a fresh in-progress state record, and leaves unrelated keys untouched.[MODIFY]
src/lib/onboarding-state.test.tsresetOnboardingState(), including the already-empty storage no-op path.[MODIFY]
src/lib/storage-keys.test.tsonboarding-state.ts(where the keys moved) and asserts both reset entry points call the shared helper, so a partial clear cannot silently return.Verification Results
resetFlow()clears every record the onboarding flow writesuser-strategy+first-depositall removed in one helperOnboardingFlowandOnboardingSettingscallresetOnboardingState(){ lastStep: 0, completed: false }record is persisted after the clearmain: +6 passing tests, 0 new failuresManual QA Steps
/onboardingand prime the three keys by completing the flow, or directly:onboarding-statenow holds{ lastStep: 0, completed: false }, and bothuser-strategyandfirst-depositare gone (DevTools → Application → Local Storage).user-strategyandfirst-depositboth remained./settings→ Onboarding → Reset onboarding and confirm the same three keys clear.Design Note
"No new duplicate abstractions without a one-line rationale" — this PR removes the duplicated clear rather than adding one: both callers now route through
onboarding-state.ts, the adapter that already owns onboarding storage, which is the shared-reset option the issue suggested.Pre-existing failures on
main(not introduced here)Clean
mainat this branch's base commit0cbb5aais already red — upstream Frontend CI run #646 on that exact SHA concludedfailure. Reproduced locally on the pristine tree: 62tscerrors and 69 unit-test failures across 12 files (src/lib/transactions.tsundefined i18n copy, the transaction/apiroutes,useTransactionAPI/useTransactionFlow/useTransactionForm,src/lib/i18n/messages.tsmissing thedomainnamespace,WalletConnectStep.test.tsxReact is not defined, and others).next buildfails at that same type-check step. None of those files are touched by this PR, and repairing that i18n migration is out of scope for #954.