Skip to content

Commit

Permalink
Attempt to fix recursive pattern test
Browse files Browse the repository at this point in the history
  • Loading branch information
mikachan committed Dec 18, 2024
1 parent 881d7b1 commit c6c423e
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function PatternCategoryPreviews( {
const [ allPatterns, , onClickPattern ] = usePatternsState(
onInsert,
rootClientId,
category
category?.name
);
const [ patternSyncFilter, setPatternSyncFilter ] = useState( 'all' );
const [ patternSourceFilter, setPatternSourceFilter ] = useState( 'all' );
Expand All @@ -69,25 +69,25 @@ export function PatternCategoryPreviews( {
return false;
}

if ( category === allPatternsCategory?.name ) {
if ( category.name === allPatternsCategory?.name ) {
return true;
}

if (
category === myPatternsCategory?.name &&
category.name === myPatternsCategory?.name &&
pattern.type === INSERTER_PATTERN_TYPES.user
) {
return true;
}

if (
category === starterPatternsCategory?.name &&
category.name === starterPatternsCategory?.name &&
pattern.blockTypes?.includes( 'core/post-content' )
) {
return true;
}

if ( category === 'uncategorized' ) {
if ( category.name === 'uncategorized' ) {
// The uncategorized category should show all the patterns without any category...
if ( ! pattern.categories ) {
return true;
Expand All @@ -99,12 +99,12 @@ export function PatternCategoryPreviews( {
);
}

return pattern.categories?.includes( category );
return pattern.categories?.includes( category.name );
} ),
[
allPatterns,
availableCategories,
category,
category.name,
patternSourceFilter,
patternSyncFilter,
]
Expand Down

0 comments on commit c6c423e

Please sign in to comment.