From 8e64ae696540d31b8b1b1e541f34826285d70011 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Mon, 11 Nov 2024 10:06:22 +0100 Subject: [PATCH] Remove the empty array fallback 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. --- .../src/components/duplicate-pattern-modal.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/patterns/src/components/duplicate-pattern-modal.js b/packages/patterns/src/components/duplicate-pattern-modal.js index 913a2e88927b5..70fb0830e0f1c 100644 --- a/packages/patterns/src/components/duplicate-pattern-modal.js +++ b/packages/patterns/src/components/duplicate-pattern-modal.js @@ -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