From 190ed953ea939f826035eaac9e1109be780e386e Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Fri, 13 Sep 2024 08:50:02 +0530 Subject: [PATCH 1/2] Update basicInfoForm.js --- src/OnboardingSPA/steps/BasicInfo/basicInfoForm.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/OnboardingSPA/steps/BasicInfo/basicInfoForm.js b/src/OnboardingSPA/steps/BasicInfo/basicInfoForm.js index 30f5334a8..1a7942dd3 100644 --- a/src/OnboardingSPA/steps/BasicInfo/basicInfoForm.js +++ b/src/OnboardingSPA/steps/BasicInfo/basicInfoForm.js @@ -36,10 +36,11 @@ const BasicInfoForm = () => { return select( coreStore ); }, [] ); - const { currentData } = useSelect( ( select ) => { + const { currentData, getEntityRecord } = useSelect( ( select ) => { return { currentData: select( nfdOnboardingStore ).getCurrentOnboardingData(), + getEntityRecord: select( coreStore ).getEntityRecord('root', 'site' , undefined), }; }, [] ); @@ -101,6 +102,10 @@ const BasicInfoForm = () => { }, [ siteTitle, siteDesc, siteLogo, socialData ] ); const updateCoreStore = ( siteLogoTemp, siteTitleTemp, siteDescTemp ) => { + // Check if the record trying to be edited exists + if( !getEntityRecord ){ + return; + } editEntityRecord( 'root', 'site', undefined, { site_logo: siteLogoTemp?.id ? siteLogoTemp.id : null, description: siteDescTemp, From f1ead394e90eed6d9581ea95bbf6b78f2937cc10 Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Fri, 13 Sep 2024 08:52:40 +0530 Subject: [PATCH 2/2] Update basicInfoForm.js --- src/OnboardingSPA/steps/BasicInfo/basicInfoForm.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/OnboardingSPA/steps/BasicInfo/basicInfoForm.js b/src/OnboardingSPA/steps/BasicInfo/basicInfoForm.js index 1a7942dd3..742d7886b 100644 --- a/src/OnboardingSPA/steps/BasicInfo/basicInfoForm.js +++ b/src/OnboardingSPA/steps/BasicInfo/basicInfoForm.js @@ -40,7 +40,11 @@ const BasicInfoForm = () => { return { currentData: select( nfdOnboardingStore ).getCurrentOnboardingData(), - getEntityRecord: select( coreStore ).getEntityRecord('root', 'site' , undefined), + getEntityRecord: select( coreStore ).getEntityRecord( + 'root', + 'site', + undefined + ), }; }, [] ); @@ -103,7 +107,7 @@ const BasicInfoForm = () => { const updateCoreStore = ( siteLogoTemp, siteTitleTemp, siteDescTemp ) => { // Check if the record trying to be edited exists - if( !getEntityRecord ){ + if ( ! getEntityRecord ) { return; } editEntityRecord( 'root', 'site', undefined, {