diff --git a/src/renderer/src/components/WorktreeJumpPalette.tsx b/src/renderer/src/components/WorktreeJumpPalette.tsx
index f18ba555d68..4e39baf2bea 100644
--- a/src/renderer/src/components/WorktreeJumpPalette.tsx
+++ b/src/renderer/src/components/WorktreeJumpPalette.tsx
@@ -8,6 +8,7 @@ import React, {
useRef,
useState
} from 'react'
+import { flushSync } from 'react-dom'
import { useShallow } from 'zustand/react/shallow'
import { useTranslation } from 'react-i18next'
import { toast } from 'sonner'
@@ -42,7 +43,6 @@ import {
CommandEmpty,
CommandItem
} from '@/components/ui/command'
-import { Button } from '@/components/ui/button'
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
import { parseGitHubIssueOrPRNumber, parseGitHubIssueOrPRLink } from '@/lib/github-links'
import { getLinkedWorkItemSuggestedName, getLinkedWorkItemWorkspaceName } from '@/lib/new-workspace'
@@ -3258,30 +3258,33 @@ function WorktreeJumpPaletteContent({
}
if (entry.type === 'hint') {
- // Why: plain div (not CommandItem) so cmdk can't select it; arrow keys skip it via selectableItems.
return (
-
{
+ const previousIndex = selectionItemIds.indexOf(renderKey)
+ flushSync(() => entry.onSeeMore?.())
+ const expandedItemId = Array.from(
+ listRef.current?.querySelectorAll('[cmdk-item]') ?? []
+ )[previousIndex]?.getAttribute('data-value')
+ if (expandedItemId) {
+ setSelectedItemId(expandedItemId)
+ }
+ inputRef.current?.focus()
+ }}
+ className={cn(
+ JUMP_PALETTE_ITEM_CLASSNAME,
+ 'mt-1 min-h-0 gap-2 py-1.5 text-[12px] text-muted-foreground'
+ )}
>
{entry.label}
{entry.onSeeMore ? (
-
+
) : null}
-
+
)
}
diff --git a/src/renderer/src/components/worktree-jump-palette-interleaved-sections.test.tsx b/src/renderer/src/components/worktree-jump-palette-interleaved-sections.test.tsx
index 854412b5107..f52bf725a5a 100644
--- a/src/renderer/src/components/worktree-jump-palette-interleaved-sections.test.tsx
+++ b/src/renderer/src/components/worktree-jump-palette-interleaved-sections.test.tsx
@@ -57,18 +57,33 @@ vi.mock('@/components/ui/command', async () => {
return {
Command: ({ children }: { children: React.ReactNode }) => {children}
,
CommandGroup: ({ children }: { children: React.ReactNode }) => {children}
,
- CommandDialog: ({ children, open }: { children: React.ReactNode; open?: boolean }) =>
- open ? {children}
: null,
- CommandInput: ({
- value,
- onValueChange
+ CommandDialog: ({
+ children,
+ open,
+ commandProps
}: {
- value?: string
- onValueChange?: (next: string) => void
- }) => {
+ children: React.ReactNode
+ open?: boolean
+ commandProps?: { value?: string }
+ }) =>
+ open ? (
+
+ {children}
+
+ ) : null,
+ CommandInput: React.forwardRef(function CommandInput(
+ {
+ value,
+ onValueChange
+ }: {
+ value?: string
+ onValueChange?: (next: string) => void
+ },
+ ref: React.ForwardedRef
+ ) {
setCommandQuery = onValueChange ?? null
- return {}} />
- },
+ return {}} />
+ }),
CommandList: React.forwardRef(function CommandList(
{ children }: { children: React.ReactNode },
ref: React.ForwardedRef
@@ -82,8 +97,22 @@ vi.mock('@/components/ui/command', async () => {
CommandEmpty: ({ children }: { children: React.ReactNode }) => (
{children}
),
- CommandItem: ({ children, value }: { children: React.ReactNode; value?: string }) => (
-