fix(staged): reset Add Repo dialog state on open#777
Merged
Conversation
The AddRepoModal is always mounted in ProjectSection, so its $state and RepoConfigForm's internal state survived across open/close cycles. After adding a repo, reopening the dialog showed the previous selection instead of a clean form, blocking adding a second repo. Reset all form state on the rising edge of `open` (false -> true) rather than on close, so the dialog's exit animation still plays with its final contents intact. RepoConfigForm now exposes a reset() on its api to clear internal-only fields (displayRepo, pendingPrNumber, showBranchPicker, resolvingPr, etc.) that the parent can't reach via bindings. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Matt Toohey <contact@matttoohey.com>
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.
Summary
The Add Repo modal stays mounted across open/close cycles, so stale state from a previous session persisted when reopening it — leaving the dialog in a confusing state (e.g. a previously selected repo, branch, or error still showing).
This resets all form state on the rising edge of
open(false → true), rather than on close, so the dialog's exit animation still plays with its final contents.Changes
repoConfigApi.reset()when the modal transitions from closed to open.reset()method to the exposed API that clears all form state, including internal-only fields the parent can't bind (deferred branch-picker timer, PR-resolution state, monorepo detection).resetto the API type definition.