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.
This commit is contained in:
Shirone
2026-01-15 22:20:30 +01:00
parent 585ae32c32
commit ec042de69c

View File

@@ -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 (