From 476c841049b7dd31b70fa727196e152253a0b303 Mon Sep 17 00:00:00 2001 From: snokpok Date: Fri, 22 Sep 2023 18:09:54 -0700 Subject: [PATCH] fix: edit modal gets opened on delete --- apps/desktop-v2/app/page.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/desktop-v2/app/page.tsx b/apps/desktop-v2/app/page.tsx index 4b649a9..15fa028 100644 --- a/apps/desktop-v2/app/page.tsx +++ b/apps/desktop-v2/app/page.tsx @@ -199,12 +199,13 @@ function Home() { label: "Edit task", shortcut: "enter", cb: (e) => { - e?.preventDefault(); // prevent typing into the task builder - // if modal is open, then don't open another one + // if the alert dialog is open, then don't open another one if (anyModalOpen) { return; } + e?.preventDefault(); // prevent typing into the task builder + if (chosenTaskIndex !== -1) { setTaskBuilderIsOpen(true); } @@ -229,7 +230,14 @@ function Home() { }, }, ], - [chosenTaskIndex, handleCheckTask, taskBuilderIsOpen, router, tasks] + [ + openTaskBuilder, + chosenTaskIndex, + anyModalOpen, + handleCheckTask, + tasks, + router, + ] ); const handleSubmitAreYouSure = () => {