Skip to content

Commit

Permalink
Combine effects
Browse files Browse the repository at this point in the history
  • Loading branch information
stokesman committed Aug 5, 2024
1 parent 762182c commit fb25f0b
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions packages/block-editor/src/components/iframe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ function Iframe( {
const isScaleFinal = useRef( false );
useEffect( () => {
if ( isZoomedOut ) {
priorContainerWidth.current = containerWidth;
return () => {
isScaleFinal.current = false;
const { documentElement, defaultView } = iframeDocument;
Expand All @@ -230,13 +231,7 @@ function Iframe( {
);
};
}
}, [ isZoomedOut ] );

useEffect( () => {
if ( ! isZoomedOut ) {
priorContainerWidth.current = containerWidth;
}
}, [ containerWidth, isZoomedOut ] );
}, [ isZoomedOut ] ); // containerWidth omitted as it needs read only when zoom out engages.

const disabledRef = useDisabled( { isDisabled: ! readonly } );
const bodyRef = useMergeRefs( [
Expand Down

0 comments on commit fb25f0b

Please sign in to comment.