perf: clean combobox focus frame effects (#4010)
This commit is contained in:
parent
3647b53e00
commit
e6c525b01e
|
|
@ -146,7 +146,15 @@ export default function AgentCombobox({
|
|||
}
|
||||
}, [])
|
||||
|
||||
React.useEffect(() => cancelFocusFrame, [cancelFocusFrame])
|
||||
const setInputNode = useCallback(
|
||||
(node: HTMLInputElement | null): void => {
|
||||
if (node === null) {
|
||||
cancelFocusFrame()
|
||||
}
|
||||
inputRef.current = node
|
||||
},
|
||||
[cancelFocusFrame]
|
||||
)
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!open) {
|
||||
|
|
@ -284,7 +292,7 @@ export default function AgentCombobox({
|
|||
>
|
||||
<Command shouldFilter={false} value={commandValue} onValueChange={setCommandValue}>
|
||||
<CommandInput
|
||||
ref={inputRef}
|
||||
ref={setInputNode}
|
||||
placeholder="Search agents..."
|
||||
value={query}
|
||||
onValueChange={setQuery}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,15 @@ export function WorkspaceCombobox({
|
|||
}
|
||||
}, [])
|
||||
|
||||
React.useEffect(() => cancelFocusFrame, [cancelFocusFrame])
|
||||
const setInputNode = React.useCallback(
|
||||
(node: HTMLInputElement | null): void => {
|
||||
if (node === null) {
|
||||
cancelFocusFrame()
|
||||
}
|
||||
inputRef.current = node
|
||||
},
|
||||
[cancelFocusFrame]
|
||||
)
|
||||
|
||||
const focusSearchInput = React.useCallback(() => {
|
||||
cancelFocusFrame()
|
||||
|
|
@ -80,7 +88,7 @@ export function WorkspaceCombobox({
|
|||
}}
|
||||
>
|
||||
<Command>
|
||||
<CommandInput ref={inputRef} placeholder="Search workspaces..." />
|
||||
<CommandInput ref={setInputNode} placeholder="Search workspaces..." />
|
||||
<CommandList className="max-h-72">
|
||||
<CommandEmpty>No workspaces found.</CommandEmpty>
|
||||
{worktrees.map((worktree) => (
|
||||
|
|
|
|||
|
|
@ -65,7 +65,15 @@ export default function RepoCombobox({
|
|||
}
|
||||
}, [])
|
||||
|
||||
React.useEffect(() => cancelFocusFrame, [cancelFocusFrame])
|
||||
const setInputNode = useCallback(
|
||||
(node: HTMLInputElement | null): void => {
|
||||
if (node === null) {
|
||||
cancelFocusFrame()
|
||||
}
|
||||
inputRef.current = node
|
||||
},
|
||||
[cancelFocusFrame]
|
||||
)
|
||||
|
||||
const focusSearchInput = useCallback(() => {
|
||||
cancelFocusFrame()
|
||||
|
|
@ -215,7 +223,7 @@ export default function RepoCombobox({
|
|||
>
|
||||
<Command shouldFilter={false} value={commandValue} onValueChange={setCommandValue}>
|
||||
<CommandInput
|
||||
ref={inputRef}
|
||||
ref={setInputNode}
|
||||
placeholder="Search projects/folders..."
|
||||
value={query}
|
||||
onValueChange={setQuery}
|
||||
|
|
|
|||
Loading…
Reference in New Issue