From b0debace29c917cbc11d9a4656196caaefa22e72 Mon Sep 17 00:00:00 2001 From: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Date: Fri, 16 Oct 2026 21:31:35 -0700 Subject: [PATCH] perf(web): the project file picker compiles without manual memoization Co-Authored-By: Claude Opus 5.5 --- .../components/files/ProjectFilePicker.tsx | 57 ++++++++----------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/apps/web/src/components/files/ProjectFilePicker.tsx b/apps/web/src/components/files/ProjectFilePicker.tsx index 38d21f6c1005..5a96a5036a10 100644 --- a/apps/web/src/components/files/ProjectFilePicker.tsx +++ b/apps/web/src/components/files/ProjectFilePicker.tsx @@ -1,5 +1,5 @@ import { useAtomValue } from "@effect/atom-react"; -import { useMemo, useState, type ReactNode } from "react"; +import { useState, type ReactNode } from "react"; import { useActiveProjectTarget, type ActiveProjectTarget } from "~/hooks/useActiveProjectTarget"; import { useTheme } from "~/hooks/useTheme"; @@ -80,38 +80,31 @@ function OpenProjectFilePicker(props: ProjectFilePickerProps & { target: ActiveP ); const { resolvedTheme } = useTheme(); const keybindings = useAtomValue(primaryServerKeybindingsAtom); - const matches = useMemo( - () => getProjectFilePickerMatches(result.entries, result.matchedQuery), - [result.entries, result.matchedQuery], - ); + const matches = getProjectFilePickerMatches(result.entries, result.matchedQuery); const hasMatchedQuery = /\S/.test(result.matchedQuery); - const items = useMemo( - () => - matches.map((match) => ({ - kind: "action", - value: `file:${match.path}`, - searchTerms: [match.name, match.path], - title: ( - - ), - description: ( - - ), - icon: , - run: async () => { - useRightPanelStore.getState().openFile(target.threadRef, match.path); - }, - })), - [hasMatchedQuery, matches, resolvedTheme, target.threadRef], - ); + const items: CommandPaletteActionItem[] = matches.map((match) => ({ + kind: "action", + value: `file:${match.path}`, + searchTerms: [match.name, match.path], + title: ( + + ), + description: ( + + ), + icon: , + run: async () => { + useRightPanelStore.getState().openFile(target.threadRef, match.path); + }, + })); const emptyStateMessage = getEmptyStateMessage(query, result.error, result.isPending);