Skip to content

Commit

Permalink
Revert "remove filter duplicates by name method as duplicates are rem…
Browse files Browse the repository at this point in the history
…oved on the server"

This reverts commit da8b04f.
  • Loading branch information
glendaviesnz committed Nov 9, 2023
1 parent da8b04f commit 83f54c5
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -37,6 +37,10 @@ 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 @@ -47,8 +51,9 @@ function preparePatterns( patterns, template, currentThemeStylesheet ) {

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

0 comments on commit 83f54c5

Please sign in to comment.