File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,17 @@ const Popup: FC<PropsWithChildren<PopupProps>> = ({
4444 } ;
4545
4646 const updatePopupPosition = useCallback ( ( ) => {
47- setPopupPosition ( getPopupPosition ( ) ) ;
47+ const newPosition = getPopupPosition ( ) ;
48+ setPopupPosition ( ( prevPosition ) => {
49+ if (
50+ prevPosition . left !== newPosition . left ||
51+ prevPosition . top !== newPosition . top ||
52+ prevPosition . transform !== newPosition . transform
53+ ) {
54+ return newPosition ;
55+ }
56+ return prevPosition ;
57+ } ) ;
4858 } , [ getPopupPosition ] ) ;
4959
5060 useResize ( updatePopupPosition ) ;
@@ -73,6 +83,7 @@ const Popup: FC<PropsWithChildren<PopupProps>> = ({
7383 } , [ targetRef , updatePopupPosition ] ) ;
7484
7585 if ( ! targetRef ) return null ;
86+
7687 if ( ! portal ) return null ;
7788
7889 return createPortal (
You can’t perform that action at this time.
0 commit comments