ref(onboarding): Decouple SCM step components from OnboardingContext#115639
Merged
Conversation
Contributor
📊 Type Coverage Diff✅ No new type safety issues introduced. Coverage: 93.58% |
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.
44817fd to
d656b50
Compare
jaydgoss
commented
May 26, 2026
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.
evanpurkhiser
approved these changes
May 26, 2026
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.
TL;DR
Decouples the four SCM onboarding step components from
OnboardingContextso they accept all flow state via props. Adapter wrappers inonboarding.tsxsource those props from context, preserving today's behavior. Unblocks the project creation variant of SCM onboarding.Refactor
ScmConnect,ScmPlatformFeatures,ScmProjectDetails, andScmRepoSelectorto read and write all flow state via props. Three adapter wrappers inonboarding.tsx(ScmConnectAdapter,ScmPlatformFeaturesAdapter,ScmProjectDetailsAdapter) source those props fromOnboardingContext, 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.
clearDerivedStatemoves out ofScmRepoSelectorand into the onboarding adapter so callers in other flows can pick their own invalidation strategy.ProjectDetailsFormStateis now exported fromonboardingContextso the project-details prop interface can name it.Alternative considered: a shared
ScmFlowContextthat 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