Skip to content

Commit

Permalink
Remove superfluous argument and move up common function call
Browse files Browse the repository at this point in the history
  • Loading branch information
delawski committed Dec 14, 2021
1 parent 5694ce5 commit f3ecdd1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions assets/src/amp-validation/counts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,13 @@ domReady( () => {
return;
}

initializeMenuItemCounts();

// If the AMP submenu is opened, fetch validation counts as soon as possible. Thanks to the preload middleware for
// `wp.apiFetch`, the validation count data should be available right away, so no actual HTTP request will be made.
if ( ampMenuItem.classList.contains( 'wp-menu-open' ) ) {
initializeMenuItemCounts();
fetchValidationCounts();

return;
} else {
createObserver( ampMenuItem );
}

initializeMenuItemCounts( true );
createObserver( ampMenuItem );
} );

0 comments on commit f3ecdd1

Please sign in to comment.