From b9bc1b16d7bd46e39d1a8d175660e744952f10a4 Mon Sep 17 00:00:00 2001 From: "lokapure.girish" Date: Thu, 8 Feb 2024 14:12:52 +0530 Subject: [PATCH] Update index.js --- .../steps/SiteGen/Preview/index.js | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/OnboardingSPA/steps/SiteGen/Preview/index.js b/src/OnboardingSPA/steps/SiteGen/Preview/index.js index 2b2845fc2..3be4bf33a 100644 --- a/src/OnboardingSPA/steps/SiteGen/Preview/index.js +++ b/src/OnboardingSPA/steps/SiteGen/Preview/index.js @@ -34,13 +34,17 @@ const SiteGenPreview = () => { updateSiteGenErrorStatus, } = useDispatch( nfdOnboardingStore ); - const { currentData, nextStep } = useSelect( ( select ) => { - return { - currentData: - select( nfdOnboardingStore ).getCurrentOnboardingData(), - nextStep: select( nfdOnboardingStore ).getNextStep(), - }; - } ); + const { currentData, nextStep, siteGenErrorStatus } = useSelect( + ( select ) => { + return { + currentData: + select( nfdOnboardingStore ).getCurrentOnboardingData(), + nextStep: select( nfdOnboardingStore ).getNextStep(), + siteGenErrorStatus: + select( nfdOnboardingStore ).getSiteGenErrorStatus(), + }; + } + ); useEffect( () => { setIsHeaderEnabled( true ); @@ -49,6 +53,10 @@ const SiteGenPreview = () => { setHeaderActiveView( HEADER_SITEGEN ); setDrawerActiveView( false ); updateInitialize( true ); + if ( ! siteGenErrorStatus ) { + loadHomepages(); + loadGlobalStyles(); + } }, [ currentData ] ); const loadHomepages = async () => {