Skip to content

Commit

Permalink
Merge pull request #29152 from tsa321/rccm-stuck
Browse files Browse the repository at this point in the history
  • Loading branch information
cead22 authored Oct 19, 2023
2 parents 35920b6 + e7da926 commit 20cd522
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/components/PopoverProvider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ function PopoverContextProvider(props) {
if (!activePopoverRef.current || (anchorRef && anchorRef !== activePopoverRef.current.anchorRef)) {
return;
}

activePopoverRef.current.close();
if (activePopoverRef.current.onCloseCallback) {
activePopoverRef.current.onCloseCallback();
}
activePopoverRef.current = null;
setIsOpen(false);
}, []);
Expand Down Expand Up @@ -106,6 +110,9 @@ function PopoverContextProvider(props) {
closePopover(activePopoverRef.current.anchorRef);
}
activePopoverRef.current = popoverParams;
if (popoverParams && popoverParams.onOpenCallback) {
popoverParams.onOpenCallback();
}
setIsOpen(true);
},
[closePopover],
Expand Down
3 changes: 2 additions & 1 deletion src/components/PopoverWithoutOverlay/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ function Popover(props) {
ref: props.withoutOverlayRef,
close: props.onClose,
anchorRef: props.anchorRef,
onCloseCallback: () => Modal.setCloseModal(null),
onOpenCallback: () => Modal.setCloseModal(() => props.onClose(props.anchorRef)),
});
} else {
props.onModalHide();
close(props.anchorRef);
Modal.onModalDidClose();
}
Modal.willAlertModalBecomeVisible(props.isVisible);
Modal.setCloseModal(props.isVisible ? () => props.onClose(props.anchorRef) : null);

// We want this effect to run strictly ONLY when isVisible prop changes
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down

0 comments on commit 20cd522

Please sign in to comment.