From cbf199e0de51cc56e9f92ce2521039367cdbfd93 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Mon, 17 Jul 2023 15:44:06 +0400 Subject: [PATCH] Site Editor: Fix incorrect 'useSelect' usage --- .../edit-site/src/components/save-panel/index.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/edit-site/src/components/save-panel/index.js b/packages/edit-site/src/components/save-panel/index.js index 418de53390cacb..5c1bcc1df281e0 100644 --- a/packages/edit-site/src/components/save-panel/index.js +++ b/packages/edit-site/src/components/save-panel/index.js @@ -39,13 +39,19 @@ const EntitiesSavedStatesForPreview = ( { onClose } ) => { activateSaveLabel = __( 'Activate' ); } - const { getTheme } = useSelect( coreStore ); - const theme = getTheme( currentlyPreviewingTheme() ); + const themeName = useSelect( ( select ) => { + const theme = select( coreStore ).getTheme( + currentlyPreviewingTheme() + ); + + return theme?.name?.rendered; + }, [] ); + const additionalPrompt = (

{ sprintf( - 'Saving your changes will change your active theme to %1$s.', - theme?.name?.rendered + 'Saving your changes will change your active theme to %s.', + themeName ) }

);