TypeScript
perf(web): the project file picker compiles without manual memoization (#20685)
Julius Marminge6ad62b8ab1a5
diff --git a/apps/web/src/components/files/ProjectFilePicker.tsx b/apps/web/src/components/files/ProjectFilePicker.tsxindex 38d21f6c100..5a96a5036a1 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<CommandPaletteActionItem[]>(- () =>- matches.map((match) => ({- kind: "action",- value: `file:${match.path}`,- searchTerms: [match.name, match.path],- title: (- <HighlightedFuzzyText- active={hasMatchedQuery}- value={match.name}- indices={match.nameMatchIndices}- />- ),- description: (- <HighlightedFuzzyText- active={hasMatchedQuery}- value={match.path}- indices={match.pathMatchIndices}- />- ),- icon: <PierreEntryIcon pathValue={match.path} kind="file" theme={resolvedTheme} />,- 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: (+ <HighlightedFuzzyText+ active={hasMatchedQuery}+ value={match.name}+ indices={match.nameMatchIndices}+ />+ ),+ description: (+ <HighlightedFuzzyText+ active={hasMatchedQuery}+ value={match.path}+ indices={match.pathMatchIndices}+ />+ ),+ icon: <PierreEntryIcon pathValue={match.path} kind="file" theme={resolvedTheme} />,+ run: async () => {+ useRightPanelStore.getState().openFile(target.threadRef, match.path);+ },+ }));const emptyStateMessage = getEmptyStateMessage(query, result.error, result.isPending);