@devries-cameron20 / t3code Mirror · read-only / commits / c36880ea67
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 06:45 UTC

perf(web): project actions settings compile without manual memoization (#20602)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 16, 2026 at 22:02 UTC c36880ea67221d81a1dcfedd462c483cd4400b1f
1 file changed +29 -36
apps/web/src/components/settings/ProjectActionsSettings.tsx
+29 -36
@@ -7,7 +7,7 @@ import {
7 } from "@t3tools/client-runtime/state/runtime";
8 import { DEFAULT_RESOLVED_KEYBINDINGS } from "@t3tools/shared/keybindings";
9 import { ChevronDownIcon, PlusIcon } from "lucide-react";
10 -import { useCallback, useMemo, useState } from "react";
10 +import { useState } from "react";
11 import { useT3ProjectFileState } from "../../hooks/useT3ProjectFileScripts";
12 import { useEnvironments } from "../../state/environments";
13 import {
@@ -84,43 +84,36 @@ export function ProjectActionsSettings() {
84 representativeMember?.environmentId ?? EnvironmentId.make("none"),
85 representativeMember?.workspaceRoot ?? null,
86 );
87 - const importableScripts = useMemo(
88 - () =>
89 - t3File.scripts.filter(
90 - (fileScript) =>
91 - !scripts.some(
92 - (script) =>
93 - script.command === fileScript.command ||
94 - script.name.toLowerCase() === fileScript.name.toLowerCase(),
95 - ),
87 + const importableScripts = t3File.scripts.filter(
88 + (fileScript) =>
89 + !scripts.some(
90 + (script) =>
91 + script.command === fileScript.command ||
92 + script.name.toLowerCase() === fileScript.name.toLowerCase(),
93 ),
97 - [scripts, t3File.scripts],
98 - );
99 - const importFileScript = useCallback(
100 - async (fileScript: T3ProjectFileScript) => {
101 - const payload: NewProjectScriptInput = {
102 - name: fileScript.name,
103 - command: fileScript.command,
104 - icon: fileScript.icon ?? "play",
105 - runOnWorktreeCreate: fileScript.runOnWorktreeCreate ?? false,
106 - waitForSetup: fileScript.runOnWorktreeCreate === true && fileScript.async === false,
107 - runOnSettle: fileScript.runOnSettle ?? false,
108 - keybinding: null,
109 - previewUrl: fileScript.previewUrl ?? null,
110 - autoOpenPreview: fileScript.previewUrl ? (fileScript.autoOpenPreview ?? false) : false,
111 - };
112 - const result = await submit(null, payload);
113 - if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
114 - const error = squashAtomCommandFailure(result);
115 - setRequest({
116 - scriptId: null,
117 - initial: payload,
118 - error: error instanceof Error ? error.message : "Failed to import action.",
119 - });
120 - }
121 - },
122 - [submit],
94 );
95 + const importFileScript = async (fileScript: T3ProjectFileScript) => {
96 + const payload: NewProjectScriptInput = {
97 + name: fileScript.name,
98 + command: fileScript.command,
99 + icon: fileScript.icon ?? "play",
100 + runOnWorktreeCreate: fileScript.runOnWorktreeCreate ?? false,
101 + waitForSetup: fileScript.runOnWorktreeCreate === true && fileScript.async === false,
102 + runOnSettle: fileScript.runOnSettle ?? false,
103 + keybinding: null,
104 + previewUrl: fileScript.previewUrl ?? null,
105 + autoOpenPreview: fileScript.previewUrl ? (fileScript.autoOpenPreview ?? false) : false,
106 + };
107 + const result = await submit(null, payload);
108 + if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
109 + const error = squashAtomCommandFailure(result);
110 + setRequest({
111 + scriptId: null,
112 + initial: payload,
113 + error: error instanceof Error ? error.message : "Failed to import action.",
114 + });
115 + }
116 + };
117
118 return (
119 <SettingsSection id="project-actions" title="Actions">