From 53fc63742777287b1f325dcd4538145a5ca99290 Mon Sep 17 00:00:00 2001 From: Miguel Fonseca <150562+mcsf@users.noreply.github.com> Date: Mon, 29 Jan 2024 15:34:20 +0000 Subject: [PATCH] Suggestion: Let ResetFilter ignore undefined filters --- packages/dataviews/src/reset-filters.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/dataviews/src/reset-filters.js b/packages/dataviews/src/reset-filters.js index d08953374bf637..414bb2f200bf73 100644 --- a/packages/dataviews/src/reset-filters.js +++ b/packages/dataviews/src/reset-filters.js @@ -4,10 +4,17 @@ import { Button } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; +function hasActiveFilters( view ) { + return ( + view.search !== '' || + view.filters?.some( ( { value } ) => value !== undefined ) + ); +} + export default function ResetFilter( { view, onChangeView } ) { return (