diff --git a/packages/mui-material/src/Popover/Popover.js b/packages/mui-material/src/Popover/Popover.js index 15812e8ede33d8..005e69e61e7549 100644 --- a/packages/mui-material/src/Popover/Popover.js +++ b/packages/mui-material/src/Popover/Popover.js @@ -280,11 +280,9 @@ const Popover = React.forwardRef(function Popover(inProps, ref) { const setPositioningStyles = React.useCallback(() => { const element = paperRef.current; - if (!element) { return; } - const positioning = getPositioningStyle(element); if (positioning.top !== null) { @@ -300,24 +298,14 @@ const Popover = React.forwardRef(function Popover(inProps, ref) { if (onEntering) { onEntering(element, isAppearing); } - - setPositioningStyles(); }; - React.useEffect(() => { - if (open) { - setPositioningStyles(); - } - }); - React.useImperativeHandle( action, () => open ? { - updatePosition: () => { - setPositioningStyles(); - }, + updatePosition: setPositioningStyles, } : null, [open, setPositioningStyles], @@ -365,6 +353,7 @@ const Popover = React.forwardRef(function Popover(inProps, ref) {