mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-10-31 06:54:35 +00:00
Merge 8db722d76c into 4d86b728dd
This commit is contained in:
commit
0975bcffea
1 changed files with 8 additions and 2 deletions
|
|
@ -199,10 +199,16 @@ export function DocumentsCommandPalette({
|
|||
for (const a of actions) items.push(a)
|
||||
}
|
||||
|
||||
// Reset selection on items change
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: search is the trigger — snap the selection back to the top result whenever the query changes
|
||||
useEffect(() => {
|
||||
setSelectedIndex(0)
|
||||
}, [])
|
||||
}, [search])
|
||||
|
||||
// Keep the selection in range when the list shrinks (async results
|
||||
// replacing recent docs, refetches, etc.)
|
||||
useEffect(() => {
|
||||
setSelectedIndex((i) => Math.min(i, Math.max(items.length - 1, 0)))
|
||||
}, [items.length])
|
||||
|
||||
// Scroll selected into view
|
||||
useEffect(() => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue