diff --git a/packages/dataviews/src/filter-summary.js b/packages/dataviews/src/filter-summary.js index fc0f8848f6a939..3c30c6837103a7 100644 --- a/packages/dataviews/src/filter-summary.js +++ b/packages/dataviews/src/filter-summary.js @@ -13,7 +13,7 @@ import { Children, Fragment } from '@wordpress/element'; /** * Internal dependencies */ -import { OPERATOR_IN, OPERATOR_NOT_IN, LAYOUT_LIST } from './constants'; +import { OPERATOR_IN, OPERATOR_NOT_IN } from './constants'; import { unlock } from './lock-unlock'; const { @@ -73,10 +73,6 @@ function WithSeparators( { children } ) { } export default function FilterSummary( { filter, view, onChangeView } ) { - if ( view.type === LAYOUT_LIST ) { - return null; - } - const filterInView = view.filters.find( ( f ) => f.field === filter.field ); const activeElement = filter.elements.find( ( element ) => element.value === filterInView?.value diff --git a/packages/dataviews/src/filters.js b/packages/dataviews/src/filters.js index f8b1e59e8c9d15..6195eefe8fe471 100644 --- a/packages/dataviews/src/filters.js +++ b/packages/dataviews/src/filters.js @@ -4,7 +4,12 @@ import FilterSummary from './filter-summary'; import AddFilter from './add-filter'; import ResetFilters from './reset-filters'; -import { ENUMERATION_TYPE, OPERATOR_IN, OPERATOR_NOT_IN } from './constants'; +import { + ENUMERATION_TYPE, + OPERATOR_IN, + OPERATOR_NOT_IN, + LAYOUT_LIST, +} from './constants'; const sanitizeOperators = ( field ) => { let operators = field.filterBy?.operators; @@ -57,7 +62,7 @@ export default function Filters( { fields, view, onChangeView } ) { const filterComponents = [ addFilter, ...filters.map( ( filter ) => { - if ( ! filter.isVisible ) { + if ( ! filter.isVisible || view.type === LAYOUT_LIST ) { return null; } @@ -72,7 +77,7 @@ export default function Filters( { fields, view, onChangeView } ) { } ), ]; - if ( filterComponents.length > 1 ) { + if ( filterComponents.length > 1 && view.type !== LAYOUT_LIST ) { filterComponents.push( { - if ( view.type === LAYOUT_LIST ) { - return null; - } - return (