From ec042de69c4aff9925765503b38c01204b115aa4 Mon Sep 17 00:00:00 2001 From: Shirone Date: Thu, 15 Jan 2026 22:20:30 +0100 Subject: [PATCH] fix: streamline context menu behavior for project removal dialog - Ensure the context menu closes consistently after the confirmation dialog, regardless of user action. - Reset confirmation state upon dialog closure to prevent unintended interactions. --- .../components/project-context-menu.tsx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/apps/ui/src/components/layout/project-switcher/components/project-context-menu.tsx b/apps/ui/src/components/layout/project-switcher/components/project-context-menu.tsx index 67afd406..af63af32 100644 --- a/apps/ui/src/components/layout/project-switcher/components/project-context-menu.tsx +++ b/apps/ui/src/components/layout/project-switcher/components/project-context-menu.tsx @@ -193,18 +193,16 @@ export function ProjectContextMenu({ const handleDialogClose = useCallback( (isOpen: boolean) => { setShowRemoveDialog(isOpen); - // Only close the context menu after dialog closes if removal was confirmed - // This prevents race condition where onClose unmounts the component - // before ConfirmDialog finishes its internal state cleanup - if (!isOpen && removeConfirmed) { + // Close the context menu when dialog closes (whether confirmed or cancelled) + // This prevents the context menu from reappearing after dialog interaction + if (!isOpen) { + // Reset confirmation state + setRemoveConfirmed(false); + // Always close the context menu when dialog closes onClose(); } - // Reset confirmation state when dialog closes (for potential reopen) - if (!isOpen) { - setRemoveConfirmed(false); - } }, - [onClose, removeConfirmed] + [onClose] ); return (