Skip to content

Commit

Permalink
Return an empty array from the memoized value of useStartPatterns() s…
Browse files Browse the repository at this point in the history
…o that the preferences modal has a value to test.
  • Loading branch information
ramonjd committed Sep 4, 2024
1 parent cff5a22 commit 57183de
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/editor/src/components/start-page-options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,14 @@ export function useStartPatterns() {
);

return useMemo( () => {
// filter patterns without postTypes declared if the current postType is page
// or patterns that declare the current postType in its post type array.
if ( ! blockPatternsWithPostContentBlockType?.length ) {
return [];
}

/*
* Filter patterns without postTypes declared if the current postType is page
* or patterns that declare the current postType in its post type array.
*/
return blockPatternsWithPostContentBlockType.filter( ( pattern ) => {
return (
( postType === 'page' && ! pattern.postTypes ) ||
Expand Down

0 comments on commit 57183de

Please sign in to comment.