From 689afc5e896cb7c07dd799f90b250ee4989b9a90 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 17 Apr 2026 05:15:13 +0000 Subject: [PATCH] Remove unused highlightedItemValue from filterBrowseEntries Remove the highlightedItemValue parameter and highlightedEntry computation from filterBrowseEntries since the result was never destructured or used by the caller. This eliminates unnecessary useMemo recomputation on every hover/highlight change in the command palette. --- apps/web/src/components/CommandPalette.logic.ts | 10 +--------- apps/web/src/components/CommandPalette.tsx | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/apps/web/src/components/CommandPalette.logic.ts b/apps/web/src/components/CommandPalette.logic.ts index 9a0a408249..b00e034ebc 100644 --- a/apps/web/src/components/CommandPalette.logic.ts +++ b/apps/web/src/components/CommandPalette.logic.ts @@ -51,10 +51,8 @@ export type CommandPaletteMode = "root" | "root-browse" | "submenu" | "submenu-b export function filterBrowseEntries(input: { browseEntries: ReadonlyArray; browseFilterQuery: string; - highlightedItemValue: string | null; }): { filteredEntries: FilesystemBrowseEntry[]; - highlightedEntry: FilesystemBrowseEntry | null; exactEntry: FilesystemBrowseEntry | null; } { const lowerFilter = input.browseFilterQuery.toLowerCase(); @@ -66,18 +64,12 @@ export function filterBrowseEntries(input: { (showHidden || !entry.name.startsWith(".")), ); - let highlightedEntry: FilesystemBrowseEntry | null = null; - if (input.highlightedItemValue?.startsWith("browse:")) { - const highlightedPath = input.highlightedItemValue.slice("browse:".length); - highlightedEntry = filteredEntries.find((entry) => entry.fullPath === highlightedPath) ?? null; - } - const exactEntry = input.browseFilterQuery.length > 0 ? (filteredEntries.find((entry) => entry.name === input.browseFilterQuery) ?? null) : null; - return { filteredEntries, highlightedEntry, exactEntry }; + return { filteredEntries, exactEntry }; } export function getBrowsePrefetchPaths(input: { diff --git a/apps/web/src/components/CommandPalette.tsx b/apps/web/src/components/CommandPalette.tsx index 537c0665b0..22ad9a28ad 100644 --- a/apps/web/src/components/CommandPalette.tsx +++ b/apps/web/src/components/CommandPalette.tsx @@ -369,8 +369,8 @@ function OpenCommandPaletteDialog() { }); const browseEntries = browseResult?.entries ?? EMPTY_BROWSE_ENTRIES; const { filteredEntries: filteredBrowseEntries, exactEntry: exactBrowseEntry } = useMemo( - () => filterBrowseEntries({ browseEntries, browseFilterQuery, highlightedItemValue }), - [browseEntries, browseFilterQuery, highlightedItemValue], + () => filterBrowseEntries({ browseEntries, browseFilterQuery }), + [browseEntries, browseFilterQuery], ); const prefetchBrowsePath = useCallback(