Skip to content

Commit

Permalink
Added Curly Braces
Browse files Browse the repository at this point in the history
  • Loading branch information
officiallygod committed Mar 2, 2023
1 parent 39c9572 commit cf875b1
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
10 changes: 7 additions & 3 deletions src/OnboardingSPA/components/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ const App = () => {
const initialData = await getSettings();
const result = await setSettings( socialData );
setDidVisitBasicInfo( false );
if ( result?.error !== null ) return initialData?.body;
if ( result?.error !== null ) {
return initialData?.body;
}
return result?.body;
}

Expand Down Expand Up @@ -122,8 +124,9 @@ const App = () => {
const socialDataResp = await syncSocialSettings();

// If Social Data is changed then Sync that also to the store
if ( socialDataResp )
if ( socialDataResp ) {
setOnboardingSocialData( socialDataResp );
}
}

const result = await setFlow( currentData );
Expand All @@ -136,8 +139,9 @@ const App = () => {
}
}
// Check if the Basic Info page was visited
if ( location?.pathname.includes( 'basic-info' ) )
if ( location?.pathname.includes( 'basic-info' ) ) {
setDidVisitBasicInfo( true );
}
if ( location?.pathname.includes( 'ecommerce' ) ) {
setDidVisitEcommerce( true );
}
Expand Down
4 changes: 3 additions & 1 deletion src/OnboardingSPA/components/ExitToWordPress/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ const ExitToWordPress = ( {
const socialDataResp = await syncSocialSettingsFinish();

// If Social Data is changed then Sync that also to the store
if ( socialDataResp ) setOnboardingSocialData( socialDataResp );
if ( socialDataResp ) {
setOnboardingSocialData( socialDataResp );
}
}
setFlow( currentData );
}
Expand Down
8 changes: 6 additions & 2 deletions src/OnboardingSPA/components/SkipButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ const SkipButton = () => {
async function syncSocialSettingsFinish() {
const initialData = await getSettings();
const result = await setSettings( socialData );
if ( result?.error !== null ) return initialData?.body;
if ( result?.error !== null ) {
return initialData?.body;
}
return result?.body;
}

Expand All @@ -45,7 +47,9 @@ const SkipButton = () => {
const socialDataResp = await syncSocialSettingsFinish();

// If Social Data is changed then Sync that also to the store
if ( socialDataResp ) setOnboardingSocialData( socialDataResp );
if ( socialDataResp ) {
setOnboardingSocialData( socialDataResp );
}
}
setFlow( currentData );
}
Expand Down
16 changes: 12 additions & 4 deletions src/OnboardingSPA/pages/Steps/BasicInfo/basicInfoForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ const BasicInfoForm = () => {
}

useEffect( () => {
if ( isSocialFormOpen ) socialMediaRef.current.scrollIntoView();
if ( isSocialFormOpen ) {
socialMediaRef.current.scrollIntoView();
}
}, [ isSocialFormOpen ] );

useEffect( () => {
Expand All @@ -79,15 +81,19 @@ const BasicInfoForm = () => {
setisLoaded( true );
setOnboardingSocialData( socialDataAPI?.body );
}
if ( ! isLoaded ) getFlowData();
if ( ! isLoaded ) {
getFlowData();
}
getEditedEntityRecord( 'root', 'site' );

setDefaultData();
}, [ isLoaded ] );

useEffect( () => {
const timerId = setTimeout( () => {
if ( isLoaded ) setDebouncedFlowData( createSaveData() );
if ( isLoaded ) {
setDebouncedFlowData( createSaveData() );
}
}, 600 );

return () => {
Expand Down Expand Up @@ -125,7 +131,9 @@ const BasicInfoForm = () => {
debouncedFlowData.data.socialData ?? socialData
);
};
if ( debouncedFlowData ) saveData();
if ( debouncedFlowData ) {
saveData();
}
}, [ debouncedFlowData ] );

return (
Expand Down

0 comments on commit cf875b1

Please sign in to comment.