Skip to content

Commit

Permalink
remove filter duplicates by name method as duplicates are removed on …
Browse files Browse the repository at this point in the history
…the server
  • Loading branch information
glendaviesnz committed Nov 8, 2023
1 parent 4afac6c commit da8b04f
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ function injectThemeAttributeInBlockTemplateContent(
}

function preparePatterns( patterns, template, currentThemeStylesheet ) {
// Filter out duplicates.
const filterOutDuplicatesByName = ( currentItem, index, items ) =>
index === items.findIndex( ( item ) => currentItem.name === item.name );

// Filter out core/directory patterns not included in theme.json.
const filterOutExcludedPatternSources = ( pattern ) =>
! EXCLUDED_PATTERN_SOURCES.includes( pattern.source );
Expand All @@ -51,9 +47,8 @@ function preparePatterns( patterns, template, currentThemeStylesheet ) {

return patterns
.filter(
( pattern, index, items ) =>
( pattern ) =>
filterOutExcludedPatternSources( pattern ) &&
filterOutDuplicatesByName( pattern, index, items ) &&
filterCompatiblePatterns( pattern )
)
.map( ( pattern ) => ( {
Expand Down

0 comments on commit da8b04f

Please sign in to comment.