Skip to content

fix(onboarding): Reset downstream state when repository changes#111479

Merged
jaydgoss merged 8 commits intomasterfrom
jaygoss/vdy-22-clear-derived-state
Mar 26, 2026
Merged

fix(onboarding): Reset downstream state when repository changes#111479
jaydgoss merged 8 commits intomasterfrom
jaygoss/vdy-22-clear-derived-state

Conversation

@jaydgoss
Copy link
Copy Markdown
Member

@jaydgoss jaydgoss commented Mar 24, 2026

When a user navigates back to repo selection and picks a different repo, the previously selected platform, features, and created project slug are stale.

Adds clearDerivedState to the onboarding context that clears these fields in a single session storage update without wiping the entire session -- which setSelectedPlatform(undefined) would do due to the removeOnboarding() call in its undefined branch.

The repo selector's onSelect callback now calls clearDerivedState() whenever the repository changes.

Stacked on PR #111478 (VDY-22: UI polish and analytics).

Refs VDY-22

@linear-code
Copy link
Copy Markdown

linear-code bot commented Mar 24, 2026

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 24, 2026
@jaydgoss jaydgoss force-pushed the jaygoss/vdy-22-clear-derived-state branch from 2210996 to 1d46164 Compare March 24, 2026 22:34
@jaydgoss jaydgoss marked this pull request as ready for review March 24, 2026 23:05
@jaydgoss jaydgoss requested a review from a team as a code owner March 24, 2026 23:05
@jaydgoss jaydgoss force-pushed the jaygoss/vdy-22-clear-derived-state branch 2 times, most recently from 434a6ef to 6fac7ea Compare March 24, 2026 23:10
@jaydgoss jaydgoss force-pushed the jaygoss/vdy-22-clear-derived-state branch from 6fac7ea to d52032d Compare March 26, 2026 13:22
@jaydgoss jaydgoss force-pushed the jaygoss/vdy-22-clear-derived-state branch from d52032d to 4881665 Compare March 26, 2026 13:26
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@jaydgoss jaydgoss force-pushed the jaygoss/vdy-22-scm-connect-step-ui-polish-and-analytics-pass branch from 7579eda to a9522c5 Compare March 26, 2026 19:42
@jaydgoss jaydgoss force-pushed the jaygoss/vdy-22-clear-derived-state branch from 938e03e to 081bf74 Compare March 26, 2026 19:42
@jaydgoss jaydgoss force-pushed the jaygoss/vdy-22-clear-derived-state branch from 081bf74 to 1d584a7 Compare March 26, 2026 19:51
@jaydgoss jaydgoss force-pushed the jaygoss/vdy-22-scm-connect-step-ui-polish-and-analytics-pass branch from a9522c5 to a1ace12 Compare March 26, 2026 19:51
Base automatically changed from jaygoss/vdy-22-scm-connect-step-ui-polish-and-analytics-pass to master March 26, 2026 20:21
@jaydgoss jaydgoss requested a review from a team as a code owner March 26, 2026 20:21
When a user goes back to repo selection and picks a different repo,
the previously selected platform, features, and created project slug
are stale. Add clearDerivedState to the onboarding context that clears
these fields without wiping the entire session (which
setSelectedPlatform(undefined) would do), and call it from the repo
selector onChange.
…repo

Add test that clearDerivedState clears selectedPlatform, selectedFeatures,
and createdProjectSlug while preserving selectedIntegration and
selectedRepository in session storage.
Replace manual ContextReader component with renderHookWithProviders and
additionalWrapper to match the established testing pattern. Also update
the connected tag assertion to match the new format.
…xture

Extract duplicated Next.js selectedPlatform object into a shared
nextJsPlatform const in the SCM test suite. Use RepositoryFixture
instead of an inline object with as any. Revert provider to inline
to match OrganizationIntegration's type shape.
…elect

Move clearDerivedState from the onSelect callback to handleChange so
it only fires on direct user interaction. The hook's error-recovery
path in handleRemove calls onSelect(previous) to restore the repo
when the hide-API fails, which was incorrectly wiping platform,
features, and created project state.

VDY-22
Without this, clearing the repo via the select's clear button leaves
the internal search term intact, causing stale results to appear when
the dropdown reopens.
Move clearDerivedState into the selection branch so error-recovery in
handleRemove can restore the repo without losing platform and feature
state. When the user clears and re-selects, clearDerivedState runs on
the new selection.
Revert the previous move — derived state must be cleared when the user
clears the repo too, otherwise stale features persist if the user
navigates back and skips without re-selecting. The error-recovery edge
case (API failure restoring repo without derived state) is an
acceptable tradeoff.
@jaydgoss jaydgoss merged commit a1eb5dc into master Mar 26, 2026
70 checks passed
@jaydgoss jaydgoss deleted the jaygoss/vdy-22-clear-derived-state branch March 26, 2026 20:40
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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