From e8e65db984296647d7d051fc1215de6834127a41 Mon Sep 17 00:00:00 2001 From: melloware Date: Wed, 11 Dec 2024 07:16:53 -0500 Subject: [PATCH] Fix #7494: ConfirmDialog do not call onHide if dialog is not visible --- components/lib/confirmdialog/ConfirmDialog.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/lib/confirmdialog/ConfirmDialog.js b/components/lib/confirmdialog/ConfirmDialog.js index 35ddef6195..2d9113da4b 100644 --- a/components/lib/confirmdialog/ConfirmDialog.js +++ b/components/lib/confirmdialog/ConfirmDialog.js @@ -92,10 +92,12 @@ export const ConfirmDialog = React.memo( }; const hide = (result = 'cancel') => { - setVisibleState(false); - callbackFromProp('onHide', { result }); - DomHandler.focus(focusElementOnHide.current); - focusElementOnHide.current = null; + if (visibleState) { + setVisibleState(false); + callbackFromProp('onHide', { result }); + DomHandler.focus(focusElementOnHide.current); + focusElementOnHide.current = null; + } }; const confirm = (updatedProps) => {