Skip to content

Commit

Permalink
Remove the empty array fallback
Browse files Browse the repository at this point in the history
The array fallback is not needed inside getTermLabels, because getTermLabels is used as the value for defaultCategories, which is an empty array by default when it is used inside the function CreatePatternModalContents.
  • Loading branch information
carolinan committed Nov 11, 2024
1 parent dbfff2f commit 8e64ae6
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/patterns/src/components/duplicate-pattern-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ import { PATTERN_SYNC_TYPES, PATTERN_TYPES } from '../constants';
function getTermLabels( pattern, categories ) {
// Theme patterns rely on core pattern categories.
if ( pattern.type !== PATTERN_TYPES.user ) {
return (
categories.core
?.filter( ( category ) =>
pattern.categories?.includes( category.name )
)
.map( ( category ) => category.label ) || []
);
return categories.core
?.filter( ( category ) =>
pattern.categories?.includes( category.name )
)
.map( ( category ) => category.label );
}

return categories.user
Expand Down

0 comments on commit 8e64ae6

Please sign in to comment.