From 02cc08a73bf0084c9509508a46c81a8a7a51f29b Mon Sep 17 00:00:00 2001 From: arthur Date: Tue, 1 Oct 2024 15:04:18 +0800 Subject: [PATCH] Fix the loading state between installation and activation --- client/state/themes/actions/install-theme.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/client/state/themes/actions/install-theme.js b/client/state/themes/actions/install-theme.js index 844e95b46b0d1..f46128d40d12e 100644 --- a/client/state/themes/actions/install-theme.js +++ b/client/state/themes/actions/install-theme.js @@ -30,11 +30,6 @@ export function installTheme( themeId, siteId ) { .post( `/sites/${ siteId }/themes/${ themeId }/install` ) .then( ( theme ) => { dispatch( receiveTheme( theme, siteId ) ); - dispatch( { - type: THEME_INSTALL_SUCCESS, - siteId, - themeId, - } ); // Install parent theme if theme requires one if ( themeId.endsWith( '-wpcom' ) ) { @@ -48,6 +43,13 @@ export function installTheme( themeId, siteId ) { } } ) .then( () => dispatch( requestThemes( siteId, {} ) ) ) + .then( () => { + dispatch( { + type: THEME_INSTALL_SUCCESS, + siteId, + themeId, + } ); + } ) .catch( ( error ) => { dispatch( { type: THEME_INSTALL_FAILURE,