Skip to content

feat(desktop): search branch selector by PR number (#PR)#95

Merged
devlint merged 9 commits into
mainfrom
feat/branch-selector-pr-search
Jul 2, 2026
Merged

feat(desktop): search branch selector by PR number (#PR)#95
devlint merged 9 commits into
mainfrom
feat/branch-selector-pr-search

Conversation

@devlint

@devlint devlint commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Let the branch-picker popover's filter box resolve #<PR number> (e.g. #9335) to the branch that PR is on and jump straight to it — GitHub Desktop-style.
  • Cache-first against the PR sidebar's already-loaded PR list; falls back to a debounced forge.getPR() call for PR numbers outside the currently-loaded page, so old/unloaded PRs are still found.
  • Exact PR-number matching only (#93 never matches #9335).
  • Branches with a known PR show a small #1234 badge (Pinned/Local/Remote sections), sourced only from the cache — never triggers a fetch on its own.
  • Pure frontend: new useBranchPrSearch composable + BranchSelector.vue wiring + i18n across all 5 locales. No backend/Tauri changes.

Test plan

  • useBranchPrSearch composable: 9/9 unit tests passing (cache hit, debounced fallback fetch, rejection/"not found", origin/ prefix stripping, debounce collapsing rapid keystrokes, scope-dispose timer cleanup)
  • vue-tsc --noEmit clean
  • Full pnpm vitest run — 345/345 tests passing
  • Manual pnpm dev:web pass against the live repo (real gh CLI): cache-hit search, badges on real branches, fallback-fetch search with a real 500 caught cleanly, exact-match-only probe, plain-text search regression check

Laurent Guitton added 6 commits July 1, 2026 09:37
Design spec and implementation plan for this feature live locally under
docs/superpowers/ (gitignored, not tracked here) — see the PR description.
Vue's ref() deep-wraps object array elements in reactive Proxies, so
prs.value never returns the original raw object — toBe (Object.is)
can never pass there. Revert the prCache workaround that didn't fix
this, and fix the actual test assertion instead.
A component unmounting mid-debounce (or mid-fetch) left the setTimeout
callback armed, so it could still fire forge.getPR() against a stale
cwd and write to refs after the owning composable instance was gone.
onScopeDispose now clears the timer alongside the existing
watch-triggered clearTimeout.
@devlint devlint marked this pull request as ready for review July 1, 2026 08:15
@devlint devlint self-assigned this Jul 1, 2026
@devlint devlint requested a review from t1gu1 July 1, 2026 20:29
Nest the pull request badge inside the branch name span and add a left
margin to ensure the badge stays correctly aligned and spaced.

🪄 Commit via GitWand

@t1gu1 t1gu1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Oh nice feature!

I simply move the tag to be align at the right of the branch name instead of being near of the actions buttons.

Show pull request badges next to branch/remote refs and allow searching
commits by PR number to help users find and track work associated with
active pull requests.

🪄 Commit via GitWand
@t1gu1

t1gu1 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

I also add PR search and badges to commit in the GitGraph, next to branch/remote refs and allow searching
commits by PR number.

image image

@t1gu1

t1gu1 commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

I found a bug where the PR numbers didn't appear if we didn't go in the PR view first.
It is now fix! ✅

Fetch the PR list (once, SWR, no polling) when entering the graph
view or opening the branch selector. This displays PR number badges on
branches without requiring the user to first open the PR panel.

🪄 Commit via GitWand
@devlint devlint merged commit eb0a879 into main Jul 2, 2026
4 checks passed
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