Skip to content

Cache branch names for faster target branch picker in Create PR view#8597

Merged
alexr00 merged 6 commits intomainfrom
copilot/support-caching-for-branch-names
Mar 25, 2026
Merged

Cache branch names for faster target branch picker in Create PR view#8597
alexr00 merged 6 commits intomainfrom
copilot/support-caching-for-branch-names

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 17, 2026

The target branch picker makes a full GraphQL paginated fetch on every open, causing noticeable delay. Branches should appear instantly on subsequent opens, and pre-fetching should warm the cache before the user even clicks.

Changes

  • In-memory branch cache in GitHubRepository: listBranches() caches results for unprefixed (full list) queries. getCachedBranches() provides synchronous retrieval.
  • Two-phase quickpick population: changeRemoteAndBranch() now shows cached branch picks immediately, then refreshes in the background with fresh API data.
  • Pre-fetch on view init: getCreateParams() fires a non-blocking listBranches() call for the base remote so the cache is warm by the time the user opens the picker.
  • Extracted buildBranchPickItems helper in quickPicks.ts shared by both branchPicks() (async, fetches) and cachedBranchPicks() (sync, cache-only).

Flow

Create PR view opens
  └─ getCreateParams() → prefetchBranches() fires in background
                            └─ listBranches() populates _branchesCache

User clicks base branch picker
  └─ cachedBranchPicks() → instant display from cache
  └─ updateItems() → background refresh with fresh API data

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • update.code.visualstudio.com
    • Triggering command: /opt/hostedtoolcache/node/20.20.1/x64/bin/node node ./out/src/test/runTests.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 3 commits March 17, 2026 14:15
Co-authored-by: ulugbekna <16353531+ulugbekna@users.noreply.github.com>
Co-authored-by: ulugbekna <16353531+ulugbekna@users.noreply.github.com>
Co-authored-by: ulugbekna <16353531+ulugbekna@users.noreply.github.com>
Copilot AI changed the title [WIP] Add caching support for branch names in new PR view Cache branch names for faster target branch picker in Create PR view Mar 17, 2026
Copilot AI requested a review from ulugbekna March 17, 2026 14:25
@ulugbekna ulugbekna requested a review from alexr00 March 18, 2026 10:49
@alexr00 alexr00 added this to the 1.114.0 milestone Mar 23, 2026
@alexr00 alexr00 marked this pull request as ready for review March 23, 2026 20:15
Copilot AI review requested due to automatic review settings March 23, 2026 20:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves responsiveness of the Create PR target/base branch picker by warming and reusing an in-memory branch list cache so the picker can render immediately on subsequent opens.

Changes:

  • Add an in-memory unprefixed branch list cache to GitHubRepository with synchronous retrieval.
  • Update the Create PR branch picker to populate from cache immediately, then refresh from the API in the background.
  • Trigger a non-blocking branch prefetch during Create PR view initialization to warm the cache.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/github/githubRepository.ts Adds _branchesCache, getCachedBranches(), and populates the cache from listBranches() for unprefixed queries.
src/github/quickPicks.ts Extracts buildBranchPickItems and adds cachedBranchPicks() for sync, cache-backed pick construction.
src/github/createPRViewProvider.ts Prefetches branches on view init and uses cached branch picks for immediate quickpick display before background refresh.
src/@types/vscode.proposed.chatSessionsProvider.d.ts Updates proposed API parameter naming/documentation for registerChatSessionContentProvider.

@alexr00 alexr00 enabled auto-merge (squash) March 25, 2026 14:43
@alexr00 alexr00 merged commit 5f5047d into main Mar 25, 2026
10 checks passed
@alexr00 alexr00 deleted the copilot/support-caching-for-branch-names branch March 25, 2026 14:44
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.

Support caching for branch names in new PR view

5 participants