Skip to content

Commit

Permalink
Loop through all resize entries
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnajdr committed Aug 30, 2024
1 parent 95881cc commit 1e305a9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/compose/src/hooks/use-resize-observer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ function ResizeElement( { onResize }: ResizeElementProps ) {
useLayoutEffect( () => {
const resizeElement = resizeElementRef.current as HTMLDivElement;
const resizeObserver = new ResizeObserver( ( entries ) => {
const newSize = extractSize( entries[ 0 ] );
resizeCallbackRef.current( newSize );
for ( const entry of entries ) {
const newSize = extractSize( entry );
resizeCallbackRef.current( newSize );
}
} );

resizeObserver.observe( resizeElement );
Expand Down

0 comments on commit 1e305a9

Please sign in to comment.