From ee54ccee7ab2a711e3279c2bf032135ca8254ac2 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Wed, 24 Aug 2022 13:10:34 +0400 Subject: [PATCH] Block Library: Fix error in useClientWidth --- packages/block-library/src/image/use-client-width.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/image/use-client-width.js b/packages/block-library/src/image/use-client-width.js index 738bfb0373f880..ddbc53536bbffa 100644 --- a/packages/block-library/src/image/use-client-width.js +++ b/packages/block-library/src/image/use-client-width.js @@ -7,7 +7,7 @@ export default function useClientWidth( ref, dependencies ) { const [ clientWidth, setClientWidth ] = useState(); function calculateClientWidth() { - setClientWidth( ref.current.clientWidth ); + setClientWidth( ref.current?.clientWidth ); } useEffect( calculateClientWidth, dependencies );