Skip to content

Commit

Permalink
Fix sync filter reset check
Browse files Browse the repository at this point in the history
  • Loading branch information
glendaviesnz committed Sep 13, 2023
1 parent a37cdd3 commit da77818
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ function PatternsExplorer( { initialCategory, rootClientId } ) {
// If the sync filter changes, we need to select the "All" category to avoid
// showing a confusing no results screen.
useEffect( () => {
if (
patternSyncFilter !== null &&
previousSyncFilter !== patternSyncFilter
) {
if ( patternSyncFilter && patternSyncFilter !== previousSyncFilter ) {
setSelectedCategory( initialCategory?.name );
}
}, [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,7 @@ function BlockPatternsTabs( {
const previousSyncFilter = usePrevious( patternSyncFilter );

// If the sync filter changes, we need to select the "All" category to avoid
// showing a confusing no results screen. We also need to clear the category
// selection when the component unmounts.
// showing a confusing no results screen.
useEffect( () => {
if ( patternSyncFilter && patternSyncFilter !== previousSyncFilter ) {
onSelectCategory( allPatternsCategory, patternSourceFilter );
Expand Down

0 comments on commit da77818

Please sign in to comment.