Skip to content

Commit

Permalink
Merge pull request #29251 from s-alves10/fix/issue-29159
Browse files Browse the repository at this point in the history
fix: remove unnecessary dependency
  • Loading branch information
jasperhuangg authored Oct 11, 2023
2 parents ff2dca9 + 944b338 commit db45b3e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/components/PopoverWithoutOverlay/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import styles from '../../styles/styles';
import * as StyleUtils from '../../styles/StyleUtils';
import getModalStyles from '../../styles/getModalStyles';
import withWindowDimensions from '../withWindowDimensions';
import usePrevious from '../../hooks/usePrevious';

function Popover(props) {
const {onOpen, close} = React.useContext(PopoverContext);
Expand All @@ -25,8 +24,6 @@ function Popover(props) {
props.outerStyle,
);

const prevIsVisible = usePrevious(props.isVisible);

React.useEffect(() => {
if (props.isVisible) {
props.onModalShow();
Expand All @@ -43,7 +40,7 @@ function Popover(props) {
Modal.willAlertModalBecomeVisible(props.isVisible);

// We prevent setting closeModal function to null when the component is invisible the first time it is rendered
if (prevIsVisible === props.isVisible && (!firstRenderRef.current || !props.isVisible)) {
if (!firstRenderRef.current || !props.isVisible) {
firstRenderRef.current = false;
return;
}
Expand All @@ -52,7 +49,7 @@ function Popover(props) {

// We want this effect to run strictly ONLY when isVisible prop changes
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props.isVisible, prevIsVisible]);
}, [props.isVisible]);

if (!props.isVisible) {
return null;
Expand Down

0 comments on commit db45b3e

Please sign in to comment.