From 7cf3dc09e337f7b7a3f319d3b92c69eba660c5ba Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Fri, 25 Oct 2024 11:10:29 +0400 Subject: [PATCH] Style Book: Fix React Compiler error --- .../edit-site/src/components/style-book/index.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/edit-site/src/components/style-book/index.js b/packages/edit-site/src/components/style-book/index.js index 93bbc6311c6865..8f4023777868ca 100644 --- a/packages/edit-site/src/components/style-book/index.js +++ b/packages/edit-site/src/components/style-book/index.js @@ -179,22 +179,20 @@ function StyleBook( { ( select ) => select( blockEditorStore ).getSettings(), [] ); + const [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig ); const settings = useMemo( () => ( { ...originalSettings, + styles: + ! isObjectEmpty( globalStyles ) && ! isObjectEmpty( userConfig ) + ? globalStyles + : originalSettings.styles, isPreviewMode: true, } ), - [ originalSettings ] + [ globalStyles, originalSettings, userConfig ] ); - const [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig ); - - settings.styles = - ! isObjectEmpty( globalStyles ) && ! isObjectEmpty( userConfig ) - ? globalStyles - : settings.styles; - return (