Skip to content

Commit

Permalink
remove unnecessary check in site pages, add extra check before scroll…
Browse files Browse the repository at this point in the history
…ing into view, prevent header menu API call when same selection made
  • Loading branch information
arunshenoy99 committed May 12, 2023
1 parent 73a78af commit c091354
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ const DesignHeaderMenu = () => {

const chosenPattern = patterns[ idx ];

if ( chosenPattern.slug === selectedPattern ) {
return true;
}

setSelectedPattern( chosenPattern.slug );
currentData.data.partHeader = chosenPattern.slug;
setCurrentOnboardingData( currentData );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ const DesignThemeStylesPreview = () => {
if (
document.getElementsByClassName(
'theme-styles-preview--drawer__list__item__title-bar--selected'
)
) &&
document.getElementsByClassName(
'theme-styles-preview--drawer__list__item__title-bar--selected'
)[ 0 ]
) {
document
.getElementsByClassName(
Expand Down
2 changes: 1 addition & 1 deletion src/OnboardingSPA/pages/Steps/SitePages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const StepSitePages = () => {
} else {
const selectedPages = sitePagesResponse.body.reduce(
( pages, sitePage ) => {
return sitePage?.selected && sitePage.selected
return sitePage?.selected
? pages.concat( sitePage.slug )
: pages;
},
Expand Down

0 comments on commit c091354

Please sign in to comment.