Skip to content
TypeScript

perf(web): the project icon picker compiles with the React Compiler (#20457)

Julius Marminge998bcc226a70
diff --git a/apps/web/reactCompiledFiles.ts b/apps/web/reactCompiledFiles.ts
index 80ed343d49e..8bdc4dce404 100644
--- a/apps/web/reactCompiledFiles.ts
+++ b/apps/web/reactCompiledFiles.ts
@@ -32,4 +32,5 @@ export const REACT_COMPILED_FILES = [
"apps/web/src/components/ThreadNotificationCoordinator.tsx",
"apps/web/src/state/queries.ts",
"apps/web/src/state/sourceControlActions.ts",
+ "apps/web/src/components/settings/ProjectFaviconPickerDialog.tsx",
] as const;
diff --git a/apps/web/src/components/settings/ProjectFaviconPickerDialog.tsx b/apps/web/src/components/settings/ProjectFaviconPickerDialog.tsx
index 5ed077f31bc..2bfbc6a1fca 100644
--- a/apps/web/src/components/settings/ProjectFaviconPickerDialog.tsx
+++ b/apps/web/src/components/settings/ProjectFaviconPickerDialog.tsx
@@ -1,7 +1,7 @@
import { useAtomValue } from "@effect/atom-react";
import type { EnvironmentId } from "@t3tools/contracts";
import { isWindowsAbsolutePath } from "@t3tools/shared/path";
-import { useMemo, useState } from "react";
+import { useState } from "react";
import { primaryServerKeybindingsAtom } from "~/state/server";
import { useTheme } from "~/hooks/useTheme";
@@ -48,23 +48,22 @@ export function ProjectFaviconPickerDialog(props: {
);
const { resolvedTheme } = useTheme();
const keybindings = useAtomValue(primaryServerKeybindingsAtom);
- const pickExternal = props.onPickExternal;
+ const { onPickExternal: pickExternal, onSelect } = props;
const fileManagerName = getLocalFileManagerName(
typeof navigator === "undefined" ? "" : navigator.platform,
);
- const items = useMemo<CommandPaletteActionItem[]>(
- () =>
- getProjectFilePickerMatches(result.entries, result.matchedQuery).map((match) => ({
- kind: "action",
- value: `project-favicon:${match.path}`,
- searchTerms: [match.name, match.path],
- title: match.name,
- description: match.path,
- icon: <PierreEntryIcon pathValue={match.path} kind="file" theme={resolvedTheme} />,
- run: async () => props.onSelect(match.path),
- })),
- [props.onSelect, resolvedTheme, result.entries, result.matchedQuery],
- );
+ const items: CommandPaletteActionItem[] = getProjectFilePickerMatches(
+ result.entries,
+ result.matchedQuery,
+ ).map((match) => ({
+ kind: "action",
+ value: `project-favicon:${match.path}`,
+ searchTerms: [match.name, match.path],
+ title: match.name,
+ description: match.path,
+ icon: <PierreEntryIcon pathValue={match.path} kind="file" theme={resolvedTheme} />,
+ run: async () => onSelect(match.path),
+ }));
return (
<CommandDialog open={props.open} onOpenChange={props.onOpenChange}>
@@ -89,7 +88,7 @@ export function ProjectFaviconPickerDialog(props: {
.then((path) => {
if (!path) return;
props.onOpenChange(false);
- props.onSelect(path);
+ onSelect(path);
})
.catch((error: unknown) => {
toastManager.add({