ref(onboarding): Persist project details form state in onboarding context#113128
Open
ref(onboarding): Persist project details form state in onboarding context#113128
Conversation
This was referenced Apr 15, 2026
…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.
f1ef345 to
63dffeb
Compare
Comment on lines
+54
to
+58
| const [projectName, setProjectName] = useState<string | null>( | ||
| projectDetailsForm?.projectName ?? null | ||
| ); | ||
| const [teamSlug, setTeamSlug] = useState<string | null>( | ||
| projectDetailsForm?.teamSlug ?? null |
Contributor
There was a problem hiding this comment.
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.
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.
Add
projectDetailsFormto 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: