From f0b127b322a55a958e21141c26c0bd693a0da3e4 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sat, 30 May 2026 20:01:03 -0700 Subject: [PATCH] Remove delete dialog checkbox reset effect (#3134) --- .../components/sidebar/DeleteWorktreeDialog.tsx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/renderer/src/components/sidebar/DeleteWorktreeDialog.tsx b/src/renderer/src/components/sidebar/DeleteWorktreeDialog.tsx index 8d2ec604e..8c678d3bf 100644 --- a/src/renderer/src/components/sidebar/DeleteWorktreeDialog.tsx +++ b/src/renderer/src/components/sidebar/DeleteWorktreeDialog.tsx @@ -113,15 +113,11 @@ const DeleteWorktreeDialog = React.memo(function DeleteWorktreeDialog() { !isBatchDelete && modalData.allowSkipConfirm !== false && childWorkspaceCount === 0 const [dontAskAgain, setDontAskAgain] = useState(false) - // Why: the checkbox is a one-shot intent captured inside the dialog — when - // the dialog closes (cancel, delete, or esc) we reset it so the next open - // starts unchecked. Without this, toggling the box and cancelling would - // silently re-surface the checked state on the next delete. - useEffect(() => { - if (!isOpen) { - setDontAskAgain(false) - } - }, [isOpen]) + if (!isOpen && dontAskAgain) { + // Why: this checkbox is a one-shot dialog intent; reset it as soon as the + // dialog is closed so a later delete never inherits a cancelled choice. + setDontAskAgain(false) + } useEffect(() => { if (isOpen && worktreeIds.length > 0 && worktrees.length === 0 && !isDeleting) {