Skip to content

ref(onboarding): Decouple SCM step components from OnboardingContext#115639

Merged
jaydgoss merged 5 commits into
masterfrom
jaygoss/vdy-72-decouple-scm-components
May 27, 2026
Merged

ref(onboarding): Decouple SCM step components from OnboardingContext#115639
jaydgoss merged 5 commits into
masterfrom
jaygoss/vdy-72-decouple-scm-components

Conversation

@jaydgoss
Copy link
Copy Markdown
Member

TL;DR

Decouples the four SCM onboarding step components from OnboardingContext so they accept all flow state via props. Adapter wrappers in onboarding.tsx source those props from context, preserving today's behavior. Unblocks the project creation variant of SCM onboarding.


Refactor ScmConnect, ScmPlatformFeatures, ScmProjectDetails, and ScmRepoSelector to read and write all flow state via props. Three adapter wrappers in onboarding.tsx (ScmConnectAdapter, ScmPlatformFeaturesAdapter, ScmProjectDetailsAdapter) source those props from OnboardingContext, preserving today's behavior.

This unblocks the project creation variant of SCM onboarding (VDY-73 through VDY-78), which needs the same components driven from local wizard state instead of session-storage-backed context.

clearDerivedState moves out of ScmRepoSelector and into the onboarding adapter so callers in other flows can pick their own invalidation strategy. ProjectDetailsFormState is now exported from onboardingContext so the project-details prop interface can name it.

Alternative considered: a shared ScmFlowContext that both flows would populate. Rejected for two-consumer scope because it reintroduces a provider wrapper in tests (the simplification this PR delivers) and adds an abstraction layer with marginal payoff at this size.

Supersedes #112948.

Refs VDY-72

@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 15, 2026

VDY-72

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 15, 2026

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.58%

@jaydgoss jaydgoss marked this pull request as ready for review May 15, 2026 16:12
@jaydgoss jaydgoss requested a review from a team as a code owner May 15, 2026 16:12
@jaydgoss jaydgoss requested a review from a team May 15, 2026 16:13
jaydgoss added 4 commits May 26, 2026 09:10
The four SCM step components (ScmConnect, ScmPlatformFeatures,
ScmProjectDetails, ScmRepoSelector) read and wrote OnboardingContext
directly, blocking reuse from any other flow. Lift the state contract
into explicit props and add adapter wrappers in onboarding.tsx that
source values from context.

The clearDerivedState side effect moves out of ScmRepoSelector and into
the onboarding adapter, so callers in other flows can choose their own
invalidation strategy.

Refs VDY-72
The test wrappers that imported this type were removed in the prior
commit, leaving it with no external consumers. Drop the export so knip
stops flagging it; the type stays in the file because the provider's
initialValue prop still references it internally.
The repo selection hook calls onRepositoryChange multiple times per
user click (optimistic + resolved/created + error paths). The previous
adapter wrapped setSelectedRepository with clearDerivedState, which
caused 2-3 redundant derived-state wipes per click and also fired
clearDerivedState during integration install (where the original code
did not).

Split the contract: ScmRepoSelector now takes an explicit
onClearDerivedState prop and fires it once at the top of handleChange,
matching the original semantics. The adapter passes setSelectedRepository
directly without wrapping.

Also tighten the handleContinue comment in scmPlatformFeatures to drop
the stale "context" reference.

Refs VDY-72
…dapter and port repo-linking tests

Followup to the rebase resolution: master added a repo-to-project
linkage in scmProjectDetails.tsx that reads selectedRepository from
context. The decoupled component now takes it as a prop, so the
ScmProjectDetailsAdapter must source it from context too. The
repo-linking tests added on master are ported to the props-based test
harness.
Comment thread static/app/views/onboarding/onboarding.tsx Outdated
The useCallback wasn't doing any stabilization work: ScmPlatformFeatures
isn't memoized, none of its internal dependency arrays reference this
callback, and setProjectDetailsForm itself is a fresh inline function
on every OnboardingContext render, so the callback's dependency churns
anyway. Inline it.
@jaydgoss jaydgoss merged commit e212fbf into master May 27, 2026
71 checks passed
@jaydgoss jaydgoss deleted the jaygoss/vdy-72-decouple-scm-components branch May 27, 2026 17:18
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.

2 participants