From 74e51eb8f0a0de3ebbfb32f0b797999dfc156d7d Mon Sep 17 00:00:00 2001 From: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Date: Fri, 16 Oct 2026 21:37:47 -0700 Subject: [PATCH] perf(web): project actions settings compile without manual memoization Co-Authored-By: Claude Opus 5.5 --- .../settings/ProjectActionsSettings.tsx | 65 +++++++++---------- 1 file changed, 29 insertions(+), 36 deletions(-) diff --git a/apps/web/src/components/settings/ProjectActionsSettings.tsx b/apps/web/src/components/settings/ProjectActionsSettings.tsx index 658644eccc47..e212f2ed9859 100644 --- a/apps/web/src/components/settings/ProjectActionsSettings.tsx +++ b/apps/web/src/components/settings/ProjectActionsSettings.tsx @@ -7,7 +7,7 @@ import { } from "@t3tools/client-runtime/state/runtime"; import { DEFAULT_RESOLVED_KEYBINDINGS } from "@t3tools/shared/keybindings"; import { ChevronDownIcon, PlusIcon } from "lucide-react"; -import { useCallback, useMemo, useState } from "react"; +import { useState } from "react"; import { useT3ProjectFileState } from "../../hooks/useT3ProjectFileScripts"; import { useEnvironments } from "../../state/environments"; import { @@ -84,43 +84,36 @@ export function ProjectActionsSettings() { representativeMember?.environmentId ?? EnvironmentId.make("none"), representativeMember?.workspaceRoot ?? null, ); - const importableScripts = useMemo( - () => - t3File.scripts.filter( - (fileScript) => - !scripts.some( - (script) => - script.command === fileScript.command || - script.name.toLowerCase() === fileScript.name.toLowerCase(), - ), + const importableScripts = t3File.scripts.filter( + (fileScript) => + !scripts.some( + (script) => + script.command === fileScript.command || + script.name.toLowerCase() === fileScript.name.toLowerCase(), ), - [scripts, t3File.scripts], - ); - const importFileScript = useCallback( - async (fileScript: T3ProjectFileScript) => { - const payload: NewProjectScriptInput = { - name: fileScript.name, - command: fileScript.command, - icon: fileScript.icon ?? "play", - runOnWorktreeCreate: fileScript.runOnWorktreeCreate ?? false, - waitForSetup: fileScript.runOnWorktreeCreate === true && fileScript.async === false, - runOnSettle: fileScript.runOnSettle ?? false, - keybinding: null, - previewUrl: fileScript.previewUrl ?? null, - autoOpenPreview: fileScript.previewUrl ? (fileScript.autoOpenPreview ?? false) : false, - }; - const result = await submit(null, payload); - if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) { - const error = squashAtomCommandFailure(result); - setRequest({ - scriptId: null, - initial: payload, - error: error instanceof Error ? error.message : "Failed to import action.", - }); - } - }, - [submit], ); + const importFileScript = async (fileScript: T3ProjectFileScript) => { + const payload: NewProjectScriptInput = { + name: fileScript.name, + command: fileScript.command, + icon: fileScript.icon ?? "play", + runOnWorktreeCreate: fileScript.runOnWorktreeCreate ?? false, + waitForSetup: fileScript.runOnWorktreeCreate === true && fileScript.async === false, + runOnSettle: fileScript.runOnSettle ?? false, + keybinding: null, + previewUrl: fileScript.previewUrl ?? null, + autoOpenPreview: fileScript.previewUrl ? (fileScript.autoOpenPreview ?? false) : false, + }; + const result = await submit(null, payload); + if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) { + const error = squashAtomCommandFailure(result); + setRequest({ + scriptId: null, + initial: payload, + error: error instanceof Error ? error.message : "Failed to import action.", + }); + } + }; return (