mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 09:13:08 +00:00
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:
@@ -193,18 +193,16 @@ export function ProjectContextMenu({
|
|||||||
const handleDialogClose = useCallback(
|
const handleDialogClose = useCallback(
|
||||||
(isOpen: boolean) => {
|
(isOpen: boolean) => {
|
||||||
setShowRemoveDialog(isOpen);
|
setShowRemoveDialog(isOpen);
|
||||||
// Only close the context menu after dialog closes if removal was confirmed
|
// Close the context menu when dialog closes (whether confirmed or cancelled)
|
||||||
// This prevents race condition where onClose unmounts the component
|
// This prevents the context menu from reappearing after dialog interaction
|
||||||
// before ConfirmDialog finishes its internal state cleanup
|
if (!isOpen) {
|
||||||
if (!isOpen && removeConfirmed) {
|
// Reset confirmation state
|
||||||
|
setRemoveConfirmed(false);
|
||||||
|
// Always close the context menu when dialog closes
|
||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
// Reset confirmation state when dialog closes (for potential reopen)
|
|
||||||
if (!isOpen) {
|
|
||||||
setRemoveConfirmed(false);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
[onClose, removeConfirmed]
|
[onClose]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user