From fb25f0be4f63b18f6176821f5dc3bbc935f7b594 Mon Sep 17 00:00:00 2001 From: Mitchell Austin Date: Sat, 3 Aug 2024 08:55:33 -0700 Subject: [PATCH] Combine effects --- packages/block-editor/src/components/iframe/index.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/block-editor/src/components/iframe/index.js b/packages/block-editor/src/components/iframe/index.js index 1cb73cc6f2ed08..bf964a6d0983fb 100644 --- a/packages/block-editor/src/components/iframe/index.js +++ b/packages/block-editor/src/components/iframe/index.js @@ -218,6 +218,7 @@ function Iframe( { const isScaleFinal = useRef( false ); useEffect( () => { if ( isZoomedOut ) { + priorContainerWidth.current = containerWidth; return () => { isScaleFinal.current = false; const { documentElement, defaultView } = iframeDocument; @@ -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( [