|
1 | 1 | import { useAtomValue } from "@effect/atom-react"; |
2 | | -import { useMemo, useState, type ReactNode } from "react"; |
| 2 | +import { useState, type ReactNode } from "react"; |
3 | 3 |
|
4 | 4 | import { useActiveProjectTarget, type ActiveProjectTarget } from "~/hooks/useActiveProjectTarget"; |
5 | 5 | import { useTheme } from "~/hooks/useTheme"; |
@@ -80,38 +80,31 @@ function OpenProjectFilePicker(props: ProjectFilePickerProps & { target: ActiveP |
80 | 80 | ); |
81 | 81 | const { resolvedTheme } = useTheme(); |
82 | 82 | const keybindings = useAtomValue(primaryServerKeybindingsAtom); |
83 | | - const matches = useMemo( |
84 | | - () => getProjectFilePickerMatches(result.entries, result.matchedQuery), |
85 | | - [result.entries, result.matchedQuery], |
86 | | - ); |
| 83 | + const matches = getProjectFilePickerMatches(result.entries, result.matchedQuery); |
87 | 84 | const hasMatchedQuery = /\S/.test(result.matchedQuery); |
88 | | - const items = useMemo<CommandPaletteActionItem[]>( |
89 | | - () => |
90 | | - matches.map((match) => ({ |
91 | | - kind: "action", |
92 | | - value: `file:${match.path}`, |
93 | | - searchTerms: [match.name, match.path], |
94 | | - title: ( |
95 | | - <HighlightedFuzzyText |
96 | | - active={hasMatchedQuery} |
97 | | - value={match.name} |
98 | | - indices={match.nameMatchIndices} |
99 | | - /> |
100 | | - ), |
101 | | - description: ( |
102 | | - <HighlightedFuzzyText |
103 | | - active={hasMatchedQuery} |
104 | | - value={match.path} |
105 | | - indices={match.pathMatchIndices} |
106 | | - /> |
107 | | - ), |
108 | | - icon: <PierreEntryIcon pathValue={match.path} kind="file" theme={resolvedTheme} />, |
109 | | - run: async () => { |
110 | | - useRightPanelStore.getState().openFile(target.threadRef, match.path); |
111 | | - }, |
112 | | - })), |
113 | | - [hasMatchedQuery, matches, resolvedTheme, target.threadRef], |
114 | | - ); |
| 85 | + const items: CommandPaletteActionItem[] = matches.map((match) => ({ |
| 86 | + kind: "action", |
| 87 | + value: `file:${match.path}`, |
| 88 | + searchTerms: [match.name, match.path], |
| 89 | + title: ( |
| 90 | + <HighlightedFuzzyText |
| 91 | + active={hasMatchedQuery} |
| 92 | + value={match.name} |
| 93 | + indices={match.nameMatchIndices} |
| 94 | + /> |
| 95 | + ), |
| 96 | + description: ( |
| 97 | + <HighlightedFuzzyText |
| 98 | + active={hasMatchedQuery} |
| 99 | + value={match.path} |
| 100 | + indices={match.pathMatchIndices} |
| 101 | + /> |
| 102 | + ), |
| 103 | + icon: <PierreEntryIcon pathValue={match.path} kind="file" theme={resolvedTheme} />, |
| 104 | + run: async () => { |
| 105 | + useRightPanelStore.getState().openFile(target.threadRef, match.path); |
| 106 | + }, |
| 107 | + })); |
115 | 108 |
|
116 | 109 | const emptyStateMessage = getEmptyStateMessage(query, result.error, result.isPending); |
117 | 110 |
|
|
0 commit comments