Skip to content

ref(onboarding): Make onboarding session exits explicit - #121022

Draft
jaydgoss wants to merge 1 commit into
feat/vdy-140-scm-messaging-experiment-flagfrom
feat/vdy-140-onboarding-session-semantics
Draft

ref(onboarding): Make onboarding session exits explicit#121022
jaydgoss wants to merge 1 commit into
feat/vdy-140-scm-messaging-experiment-flagfrom
feat/vdy-140-onboarding-session-semantics

Conversation

@jaydgoss

Copy link
Copy Markdown
Member

TLDR

Clearing the selected platform in SCM onboarding no longer discards the connected repository and every other staged choice. The five exits that genuinely want a clean slate now say so explicitly.

Details

setSelectedPlatform(undefined) was routed through removeOnboarding(), so a setter named after one field wiped the entire session. That coupling was invisible at every call site, and it made the setter unsafe for any state that should outlive a platform change — which is the blocker for the messaging destination VDY-140 stacks on top of this. The refactor lands on its own because it changes legacy onboarding behavior and deserves review on those terms, not buried in the experiment work.

OnboardingContextProvider now exposes resetOnboarding alongside the existing clearDerivedState, and setSelectedPlatform behaves like every sibling setter: it writes one field. The five full-flow exits call resetOnboarding directly — the global Skip Onboarding link in onboarding.tsx, the SCM header OnboardingSkipButton, back-from-select-platform and project deletion without state preservation in useBackActions, and the legacy cleanup in useConfigureSdk. useWelcomeAnalyticsEffect is the one caller that wanted neither: on the SCM path it clears repo-derived state via clearDerivedState, which already existed for repository changes, and falls back to a full reset only for the legacy flow.

Routing the exits through a named function rather than keeping the overload means the destructive call is greppable and each site states its intent. The alternative — leaving the setter destructive and adding a second non-destructive setter — preserves the trap for the next caller who reasonably assumes a field setter touches one field.

The user-visible consequence is in scmPlatformFeaturesCore, whose clearable platform Select calls onPlatformChange(undefined). That control previously destroyed the SCM integration and repository selection as a side effect of clearing a platform; it now leaves them intact. New coverage in onboardingContext.spec.tsx pins both halves: clearing a field preserves the rest of the session, and resetOnboarding clears persisted state. The reset test seeds sessionStorage directly rather than using the initialValue prop, because useSessionStorage's removeItem restores in-memory state back to initialValue — a seeded prop would be restored rather than cleared, which the real provider never does since it passes no initialValue.

Refs VDY-140

setSelectedPlatform(undefined) routed through removeOnboarding, so clearing one
field wiped the entire onboarding session. That coupling was invisible at the
call sites and made the field setter unsafe for any state that should outlive a
platform change.

Field setters are now local to their field, and the five full-flow exits that
genuinely want a clean session call resetOnboarding explicitly: global Skip
Onboarding, the SCM header Skip, back-from-select-platform, project deletion
without state preservation, and the legacy welcome-step cleanup. The SCM welcome
path uses clearDerivedState instead, which already existed for repository
changes.

User-visible effect: the platform picker's clear control in the SCM flow no
longer discards the connected repository.
@linear-code

linear-code Bot commented Jul 31, 2026

Copy link
Copy Markdown

VDY-140

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant