Skip to content

Commit

Permalink
update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian committed Oct 11, 2023
1 parent e07cd80 commit 3bd79a7
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ function filterPatterns( patterns, template ) {
const filterOutDuplicatesByName = ( currentItem, index, items ) =>
index === items.findIndex( ( item ) => currentItem.name === item.name );

// Filter only the patterns that are compatible with the current template.
// Looks for patterns that have the same template type as the current template,
// or have a block type that matches the current template area.
const filterCompatiblePatterns = ( pattern ) =>
pattern.templateTypes?.includes( template.slug ) ||
pattern.blockTypes?.includes( 'core/template-part/' + template.area ); // TODO - get this working for templates.
pattern.blockTypes?.includes( 'core/template-part/' + template.area );

return patterns.filter(
filterOutDuplicatesByName && filterCompatiblePatterns
Expand Down

0 comments on commit 3bd79a7

Please sign in to comment.