Skip to content

ref(onboarding): Persist project details form state in onboarding context#113128

Open
jaydgoss wants to merge 1 commit intomasterfrom
jaygoss/ref-onboarding-context-persist-form-state
Open

ref(onboarding): Persist project details form state in onboarding context#113128
jaydgoss wants to merge 1 commit intomasterfrom
jaygoss/ref-onboarding-context-persist-form-state

Conversation

@jaydgoss
Copy link
Copy Markdown
Member

@jaydgoss jaydgoss commented Apr 15, 2026

Add projectDetailsForm to the onboarding session state so the SCM project details step can restore the user's previous inputs (name, team, alert config, platform) when navigating back from setup-docs.

PR stack:

  • PR 1 (this): Context refactor -- persist form state
  • PR 2: Gap fixes for SCM project creation
  • PR 3: VDY-82 feature flag gating

…text

Add projectDetailsForm to the onboarding session state so the SCM
project details step can restore the user's previous inputs (name,
team, alert config) when navigating back from setup-docs. This
mirrors the pattern used by createProject.tsx which persists form
state to localStorage for the same purpose.
@jaydgoss jaydgoss force-pushed the jaygoss/ref-onboarding-context-persist-form-state branch from f1ef345 to 63dffeb Compare April 15, 2026 23:55
@jaydgoss jaydgoss marked this pull request as ready for review April 16, 2026 00:10
@jaydgoss jaydgoss requested a review from a team as a code owner April 16, 2026 00:10
Comment on lines +54 to +58
const [projectName, setProjectName] = useState<string | null>(
projectDetailsForm?.projectName ?? null
);
const [teamSlug, setTeamSlug] = useState<string | null>(
projectDetailsForm?.teamSlug ?? null
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The project details form restores state from session storage without validating if the stored platform matches the current selection, leading to stale data if the user changes platforms mid-onboarding.
Severity: MEDIUM

Suggested Fix

When initializing the projectName state, add a check to ensure the platform stored in projectDetailsForm matches the currently selectedPlatform.key. If they do not match, the projectName should be initialized as null to clear the stale data. For example: useState<string | null>(projectDetailsForm?.platform === selectedPlatform?.key ? projectDetailsForm?.projectName : null).

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: static/app/views/onboarding/scmProjectDetails.tsx#L54-L58

Potential issue: The `scmProjectDetails.tsx` component restores form state from session
storage, including the project name and the platform it was created for. However, when
initializing the form, it fails to validate if the stored platform
(`projectDetailsForm.platform`) matches the currently selected platform
(`selectedPlatform.key`). If a user navigates back, changes their SCM platform, and then
returns to the project details step, the form will incorrectly display the project name
associated with the previous platform selection. This happens because the `platform`
field, which was added specifically to detect such changes, is never actually read or
used for validation.

Did we get this right? 👍 / 👎 to inform future reviews.

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