Skip to content

Commit

Permalink
Try to avoid infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
ciampo committed Sep 1, 2022
1 parent 67e35de commit 1de32a8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/components/src/popover/index.js
Expand Up @@ -215,7 +215,6 @@ const Popover = (

const arrowRef = useRef( null );

const [ referenceElement, setReferenceElement ] = useState();
const [ fallbackReferenceElement, setFallbackReferenceElement ] =
useState();
const [ referenceOwnerDocument, setReferenceOwnerDocument ] = useState();
Expand Down Expand Up @@ -378,7 +377,6 @@ const Popover = (

referenceCallbackRef( resultingReferenceElement );

setReferenceElement( resultingReferenceElement );
setReferenceOwnerDocument( resultingReferenceOwnerDoc );
}, [
anchor,
Expand Down Expand Up @@ -502,7 +500,7 @@ const Popover = (
content = <Fill name={ slotName }>{ content }</Fill>;
}

if ( referenceElement && referenceElement !== fallbackReferenceElement ) {
if ( anchorRef || anchorRect || anchor ) {
return content;
}

Expand Down

0 comments on commit 1de32a8

Please sign in to comment.