From ef5887d972d1ba18214b7c33a668a23c9e36d4e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com> Date: Mon, 6 Nov 2023 12:29:43 +0100 Subject: [PATCH] DataViews: fix status filter upon switching the default views from the sidebar (#55856) --- packages/edit-site/src/components/dataviews/in-filter.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/edit-site/src/components/dataviews/in-filter.js b/packages/edit-site/src/components/dataviews/in-filter.js index e1f3dcca4c8c92..826e94de652de3 100644 --- a/packages/edit-site/src/components/dataviews/in-filter.js +++ b/packages/edit-site/src/components/dataviews/in-filter.js @@ -9,9 +9,14 @@ import { const OPERATOR_IN = 'in'; export default ( { filter, view, onChangeView } ) => { - const activeValue = view.filters.find( + const valueFound = view.filters.find( ( f ) => f.field === filter.id && f.operator === OPERATOR_IN - )?.value; + ); + + const activeValue = + ! valueFound || ! valueFound.hasOwnProperty( 'value' ) + ? '' + : valueFound.value; return (