authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-17 23:09:09-08:00
committergravatar for jmarminge@gmail.comJulius Marminge <jmarminge@gmail.com> 2026-02-18 00:59:06-08:00
loged40fd3364b7bb575f55ddf07475e7689a037a32
tree116bc0f720f4549653e2f749408f2db36a60c7a6
parent88f31d2f65b1db7a557320d99f70b8c707cfdf4f

Reset script dialog state after close animation

- Clear form fields only after the dialog close completes to avoid stale state during transitions - Keep icon picker closed when the dialog closes Co-authored-by: codex <codex@users.noreply.github.com>

1 files changed, 19 insertions(+), 8 deletions(-)

apps/web/src/components/ProjectScriptsControl.tsx+19-8
...@@ -225,13 +225,7 @@ export default function ProjectScriptsControl({...@@ -225,13 +225,7 @@ export default function ProjectScriptsControl({
225 await onAddScript(payload);225 await onAddScript(payload);
226 }226 }
227 setDialogOpen(false);227 setDialogOpen(false);
228 setEditingScriptId(null);
229 setName("");
230 setCommand("");
231 setIcon("play");
232 setIconPickerOpen(false);228 setIconPickerOpen(false);
233 setRunOnWorktreeCreate(false);
234 setKeybinding("");
235 } catch (error) {229 } catch (error) {
236 setValidationError(error instanceof Error ? error.message : "Failed to save action.");230 setValidationError(error instanceof Error ? error.message : "Failed to save action.");
237 }231 }
...@@ -339,7 +333,25 @@ export default function ProjectScriptsControl({...@@ -339,7 +333,25 @@ export default function ProjectScriptsControl({
339 </Button>333 </Button>
340 )}334 )}
341335
342 <Dialog onOpenChange={setDialogOpen} open={dialogOpen}>336 <Dialog
337 onOpenChange={(open) => {
338 setDialogOpen(open);
339 if (!open) {
340 setIconPickerOpen(false);
341 }
342 }}
343 onOpenChangeComplete={(open) => {
344 if (open) return;
345 setEditingScriptId(null);
346 setName("");
347 setCommand("");
348 setIcon("play");
349 setRunOnWorktreeCreate(false);
350 setKeybinding("");
351 setValidationError(null);
352 }}
353 open={dialogOpen}
354 >
343 <DialogPopup>355 <DialogPopup>
344 <DialogHeader>356 <DialogHeader>
345 <DialogTitle>{isEditing ? "Edit Action" : "Add Action"}</DialogTitle>357 <DialogTitle>{isEditing ? "Edit Action" : "Add Action"}</DialogTitle>
...@@ -437,7 +449,6 @@ export default function ProjectScriptsControl({...@@ -437,7 +449,6 @@ export default function ProjectScriptsControl({
437 variant="outline"449 variant="outline"
438 onClick={() => {450 onClick={() => {
439 setDialogOpen(false);451 setDialogOpen(false);
440 setEditingScriptId(null);
441 }}452 }}
442 >453 >
443 Cancel454 Cancel