From 8d6caa1f11ba7aee7c2e285abecf4b0dae484bbf Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Mon, 13 Apr 2026 19:08:10 -0700 Subject: [PATCH] fix: show create-worktree action in jump palette only on empty results (#611) The "Create worktree" item in Cmd+J now only appears when the search query produces no matching worktrees, keeping the list uncluttered when existing worktrees already satisfy the search. --- src/renderer/src/components/WorktreeJumpPalette.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/components/WorktreeJumpPalette.tsx b/src/renderer/src/components/WorktreeJumpPalette.tsx index 5c807ae8..9566d62b 100644 --- a/src/renderer/src/components/WorktreeJumpPalette.tsx +++ b/src/renderer/src/components/WorktreeJumpPalette.tsx @@ -99,9 +99,10 @@ export default function WorktreeJumpPalette(): React.JSX.Element | null { [sortedWorktrees, query, repoMap, prCache, issueCache] ) const createWorktreeName = query.trim() - // Why: only surface the create-worktree action after the user has typed a query, - // so it doesn't clutter the default (empty-query) list of recent worktrees. - const showCreateAction = canCreateWorktree && createWorktreeName.length > 0 + // Why: only surface the create-worktree action when the query yields no matches, + // so it doesn't clutter the list when existing worktrees already satisfy the search. + const showCreateAction = + canCreateWorktree && createWorktreeName.length > 0 && matches.length === 0 // Build a map of worktreeId -> Worktree for quick lookup const worktreeMap = useMemo(() => {