mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-30 06:12:03 +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(
|
||||
(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 (
|
||||
|
||||
Reference in New Issue
Block a user