Skip to content

fix(code): Limit combobox items to 50 in branch and repo pickers#1800

Merged
VojtechBartos merged 1 commit intomainfrom
vojta/fix-repo-branch-pickers
Apr 22, 2026
Merged

fix(code): Limit combobox items to 50 in branch and repo pickers#1800
VojtechBartos merged 1 commit intomainfrom
vojta/fix-repo-branch-pickers

Conversation

@VojtechBartos
Copy link
Copy Markdown
Member

Problem

PR #1588 added performance optimizations to the branch and repo picker comboboxes — capping rendered items at 50 and showing a "type to filter" hint when truncated. PR #1725 rewrote the Combobox from the custom compound component to @posthog/quill, but dropped these optimizations in the process. All items now render to the DOM, causing noticeable lag when opening the picker on repos with hundreds of branches.

Solution

Pass limit={50} to the quill Combobox in both BranchSelector and GitHubRepoPicker, and show a "Showing 50 of N — type to filter" footer when the list is truncated.

Showcase

code-perf.mov

@VojtechBartos VojtechBartos requested a review from a team April 22, 2026 07:16
@VojtechBartos VojtechBartos self-assigned this Apr 22, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 22, 2026

Prompt To Fix All With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx
Line: 221-225

Comment:
**`CREATE_BRANCH_ACTION` silently cut off at 50+ branches**

In non-cloud mode `allItems = [...branches, CREATE_BRANCH_ACTION]`, so when `branches.length >= 50` the sentinel string is at index ≥ 50 and the `limit={50}` prop on `<Combobox items={allItems}>` will drop it — the "Create new branch" button disappears from the picker with no indication to the user. The footer condition `branches.length > COMBOBOX_LIMIT` also misses the edge case at exactly 50 branches (where `allItems.length` is 51 and limiting is already active).

The limit and footer condition should be applied to `allItems.length`, and the `CREATE_BRANCH_ACTION` sentinel should be excluded from the items fed to the `limit` prop — e.g. pass only `branches` (or the cloud branch list) as `items`, and render the create-branch footer outside the limited list.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx
Line: 21

Comment:
**Duplicated constant — violates OnceAndOnlyOnce**

`COMBOBOX_LIMIT = 50` is defined identically in both `BranchSelector.tsx` and `GitHubRepoPicker.tsx`. It should live in a single shared location (e.g. a `constants.ts` file under the renderer) so a future change only needs to happen in one place.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(code): Limit combobox items to 50 in..." | Re-trigger Greptile

Comment thread apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx Outdated
import { useMutation, useQuery } from "@tanstack/react-query";
import { type RefObject, useEffect, useRef, useState } from "react";

const COMBOBOX_LIMIT = 50;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Duplicated constant — violates OnceAndOnlyOnce

COMBOBOX_LIMIT = 50 is defined identically in both BranchSelector.tsx and GitHubRepoPicker.tsx. It should live in a single shared location (e.g. a constants.ts file under the renderer) so a future change only needs to happen in one place.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx
Line: 21

Comment:
**Duplicated constant — violates OnceAndOnlyOnce**

`COMBOBOX_LIMIT = 50` is defined identically in both `BranchSelector.tsx` and `GitHubRepoPicker.tsx`. It should live in a single shared location (e.g. a `constants.ts` file under the renderer) so a future change only needs to happen in one place.

How can I resolve this? If you propose a fix, please make it concise.

@VojtechBartos VojtechBartos force-pushed the vojta/fix-repo-branch-pickers branch from 5a73a1e to 9c45fe0 Compare April 22, 2026 07:26
@VojtechBartos VojtechBartos merged commit 2b4d328 into main Apr 22, 2026
15 checks passed
@VojtechBartos VojtechBartos deleted the vojta/fix-repo-branch-pickers branch April 22, 2026 07:32
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.

2 participants