@devries-cameron20 / t3code Mirror · read-only / commits / 87ce906e4f
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, 05:30 UTC

fix(web): a project action's error belongs to the request that opened it (#20891)

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

Julius Marminge committed Oct 17, 2026 at 03:52 UTC 87ce906e4fba8e7a76426f6bda0553061affb7ab
1 file changed +15 -6
apps/web/src/components/projectScriptEditor.tsx
+15 -6
@@ -158,14 +158,23 @@ export function ProjectScriptEditorDialog({
158 onClose: () => void;
159 }) {
160 const canEditActions = useEnvironmentScope(environmentId, editScope);
161 - const [validationError, setValidationError] = useState<string | null>(null);
161 + // Keyed by the request it belongs to: a new request starts from its own error,
162 + // and a late save from the previous request can't overwrite it.
163 + const [errorState, setErrorState] = useState<{
164 + readonly request: ProjectScriptEditorRequest;
165 + readonly message: string | null;
166 + } | null>(null);
167 + const validationError =
168 + request === null
169 + ? null
170 + : errorState?.request === request
171 + ? errorState.message
172 + : (request.error ?? null);
173 + const setValidationError = (message: string | null) => {
174 + if (request !== null) setErrorState({ request, message });
175 + };
176 const [deleteConfirmOpen, setDeleteConfirmOpen] = useComposerMenuState(!canEditActions);
177 const [deleteName, setDeleteName] = useState("");
164 - const [errorRequest, setErrorRequest] = useState<ProjectScriptEditorRequest | null>(null);
165 - if (request !== errorRequest) {
166 - setErrorRequest(request);
167 - if (request) setValidationError(request.error ?? null);
168 - }
178
179 return (
180 <>