Skip to content

fix(staged): reset Add Repo dialog state on open#777

Merged
matt2e merged 1 commit into
mainfrom
add-repo-button-stuck
Jun 10, 2026
Merged

fix(staged): reset Add Repo dialog state on open#777
matt2e merged 1 commit into
mainfrom
add-repo-button-stuck

Conversation

@matt2e

@matt2e matt2e commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

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

  • AddRepoModal.svelte: Reset all local state and call the new repoConfigApi.reset() when the modal transitions from closed to open.
  • RepoConfigForm.svelte: Add a 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).
  • NewProjectForm.svelte: Add reset to the API type definition.

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>
@matt2e matt2e requested review from baxen and wesbillman as code owners June 10, 2026 01:51
@matt2e matt2e merged commit 55b3f9d into main Jun 10, 2026
5 checks passed
@matt2e matt2e deleted the add-repo-button-stuck branch June 10, 2026 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant