Skip to content

Commit

Permalink
Fix user pattern categories in the sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Jul 5, 2024
1 parent ec45990 commit 30e12ca
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ export default function usePatternCategories() {

// Update the category counts to reflect user registered patterns.
userPatterns.forEach( ( pattern ) => {
pattern.categories?.forEach( ( category ) => {
pattern.wp_pattern_category?.forEach( ( catId ) => {
const category = userPatternCategories.find(
( cat ) => cat.id === catId
)?.name;
if ( categoryMap[ category ] ) {
categoryMap[ category ].count += 1;
}
Expand Down

0 comments on commit 30e12ca

Please sign in to comment.