Skip to content

fix(staged): make Add Repo dropdown open reliably and key excludes by subpath#754

Open
matt2e wants to merge 1 commit into
mainfrom
add-repo-broken
Open

fix(staged): make Add Repo dropdown open reliably and key excludes by subpath#754
matt2e wants to merge 1 commit into
mainfrom
add-repo-broken

Conversation

@matt2e
Copy link
Copy Markdown
Contributor

@matt2e matt2e commented May 27, 2026

Summary

  • Defer the autofocus in RepoSearchInput so the click that opens the Add Repo modal finishes bubbling before the dropdown opens, preventing the window-level outside-click handler from immediately closing it.
  • Force the dropdown open on input so typing reliably surfaces results.
  • Key the excludeRepos set by githubRepo + subpath (separated by \x00) instead of just the repo name, so the same GitHub repo can be added at different subpaths. The exclusion still applies when the repo + subpath combo is already in the project, with a clear error message in the modal.
  • Stop filtering by excludeRepos in the repo/search result lists in RepoSearchInput since exclusion is now scoped to subpath and enforced at submit time.

Test plan

  • Open the Add Repo modal; the search dropdown opens reliably on focus and on typing.
  • Add a repo at one subpath, then add the same repo at a different subpath — both succeed.
  • Attempt to add a repo at a subpath already used in the project — see the "already in the project" error.

… subpath

The Add Repo dialog had two bugs. First, the click that opened the modal
also reached the freshly-attached window-level click-outside listener and
closed the dropdown the autofocused input had just opened. Defer the
autofocus call so that initial click finishes bubbling first, and also
reopen the dropdown defensively on input. Second, the project's existing
repos were being excluded by `nameWithOwner` alone, which dropped the
same repo at other subpaths from recents/chips and filtered GitHub search
results that have no subpath at all. Key excludes by `(repo, subpath)`
instead, drop the exclusion from search results entirely, and surface a
duplicate error at submit time in AddRepoModal.

Signed-off-by: Matt Toohey <contact@matttoohey.com>
@matt2e matt2e requested review from baxen and wesbillman as code owners May 27, 2026 06:38
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