Skip to content

feat(repos): Add ScmRepositoryTable component and useRepoSearch hook#113570

Merged
evanpurkhiser merged 1 commit intomasterfrom
evanpurkhiser/feat-repos-add-scmrepositorytable-component-and-usereposearch-hook
Apr 28, 2026
Merged

feat(repos): Add ScmRepositoryTable component and useRepoSearch hook#113570
evanpurkhiser merged 1 commit intomasterfrom
evanpurkhiser/feat-repos-add-scmrepositorytable-component-and-usereposearch-hook

Conversation

@evanpurkhiser
Copy link
Copy Markdown
Member

Introduce a reusable component for listing SCM integrations and their
repositories, along with a hook that wraps Fuse.js for filtering and
highlighting repository matches.

@evanpurkhiser evanpurkhiser requested a review from a team as a code owner April 21, 2026 17:58
@evanpurkhiser evanpurkhiser requested review from itsdangold and removed request for a team April 21, 2026 17:58
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 21, 2026
Comment thread static/app/views/settings/organizationRepositories/scmRepositoryTable.tsx Outdated
Comment thread static/app/views/settings/organizationRepositories/scmRepositoryTable.tsx Outdated
Comment thread static/app/views/settings/organizationRepositories/scmRepositoryTable.tsx Outdated
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-repos-add-scmrepositorytable-component-and-usereposearch-hook branch from 3d5293c to 4f88047 Compare April 28, 2026 19:51
@evanpurkhiser evanpurkhiser enabled auto-merge (squash) April 28, 2026 19:51
Comment thread static/app/views/settings/organizationRepositories/scmRepositoryTable.tsx Outdated
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4f88047. Configure here.

@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-repos-add-scmrepositorytable-component-and-usereposearch-hook branch from 4f88047 to ddefcf4 Compare April 28, 2026 20:16
Comment on lines +25 to +35
return undefined;
}

const matches: ScmRepoMatches = {};
for (const result of fuse.search(query)) {
if (result.matches) {
matches[result.item.id] = result.matches;
}
}
return matches;
}, [fuse, query]);
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: When the repositories list changes during an active search, useRepoSearch can briefly return undefined, causing the UI to flicker and show all repositories momentarily.
Severity: LOW

Suggested Fix

To prevent the flicker, useRepoSearch should not return undefined during re-initialization. It could retain the previous search results or an empty map until the new search index is ready. This ensures the UI remains stable when the underlying repository data changes.

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/settings/organizationRepositories/useRepoSearch.tsx#L21-L35

Potential issue: The `useRepoSearch` hook utilizes `useFuzzySearch`, which initializes
the search index asynchronously. If the `repositories` array provided to the hook
changes its identity while a search query is active, the internal `fuse` instance is
temporarily set to `null`. This causes `useRepoSearch` to return `undefined`. The
consuming component then falls back to displaying the entire list of repositories,
resulting in a brief UI flicker where the unfiltered list is shown before the filtered
results reappear.

Also affects:

  • static/app/views/settings/organizationRepositories/scmRepositoryTable.tsx:220~223

Comment on lines +24 to +26
if (!query || !fuse) {
return undefined;
}
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: When a user searches before the Fuse.js index has finished its initial asynchronous load, all repositories are displayed momentarily instead of the filtered results, causing a flicker.
Severity: LOW

Suggested Fix

The useFuzzySearch hook should expose a loading state. The useRepoSearch hook can then use this state to return a more specific value, like an empty object {}, to indicate that a search is in progress but has no results yet. This would prevent the parent component from defaulting to showing all items.

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/settings/organizationRepositories/useRepoSearch.tsx#L24-L26

Potential issue: The `useFuzzySearch` hook returns a `null` value for the `fuse`
instance while it asynchronously loads the Fuse.js library and builds the search index.
The calling component, `useRepoSearch`, checks `if (!fuse)` and returns `undefined`. The
`scmRepositoryTable` component then interprets `repoMatches === undefined` as a signal
to display all repositories, without any filtering. If a user types a search query
during this initial loading window, the UI will incorrectly show all repositories until
the Fuse index is ready, at which point the list will suddenly filter, causing a visual
flicker and a confusing user experience.

Also affects:

  • static/app/views/settings/organizationRepositories/scmRepositoryTable.tsx:222~224

@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-repos-add-scmrepositorytable-component-and-usereposearch-hook branch from 83c488a to a9105e4 Compare April 28, 2026 21:46
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-repos-add-scmrepositorytable-component-and-usereposearch-hook branch from a9105e4 to 4d87215 Compare April 28, 2026 22:16
Introduce a reusable component for listing SCM integrations and their
repositories, along with a hook that wraps Fuse.js for filtering and
highlighting repository matches.
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-repos-add-scmrepositorytable-component-and-usereposearch-hook branch from 4d87215 to d058029 Compare April 28, 2026 22:20
@evanpurkhiser evanpurkhiser enabled auto-merge (squash) April 28, 2026 22:35
@evanpurkhiser evanpurkhiser merged commit 90944dc into master Apr 28, 2026
70 of 72 checks passed
@evanpurkhiser evanpurkhiser deleted the evanpurkhiser/feat-repos-add-scmrepositorytable-component-and-usereposearch-hook branch April 28, 2026 23:01
cleptric pushed a commit that referenced this pull request May 5, 2026
…113570)

Introduce a reusable component for listing SCM integrations and their
repositories, along with a hook that wraps Fuse.js for filtering and
highlighting repository matches.
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.

2 participants