Skip to content

Commit

Permalink
Fix TypeError when duplicating uncategorized theme patterns (#66889)
Browse files Browse the repository at this point in the history
* Fix TypeError when duplicating uncategorized patterns
Only try to match the pattern categories and get the category label if the theme pattern uses the optional `categories` parameter.

Co-authored-by: carolinan <poena@git.wordpress.org>
Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
Co-authored-by: getdave <get_dave@git.wordpress.org>
  • Loading branch information
4 people authored Nov 11, 2024
1 parent de52623 commit c9e4eab
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function getTermLabels( pattern, categories ) {
if ( pattern.type !== PATTERN_TYPES.user ) {
return categories.core
?.filter( ( category ) =>
pattern.categories.includes( category.name )
pattern.categories?.includes( category.name )
)
.map( ( category ) => category.label );
}
Expand Down

1 comment on commit c9e4eab

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in c9e4eab.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11777016404
📝 Reported issues:

Please sign in to comment.