From 2edd27d1f7c1491a6b6619313b946807f036f867 Mon Sep 17 00:00:00 2001 From: David Szabo Date: Thu, 28 Jan 2021 15:20:42 +0100 Subject: [PATCH] Disable filtering for server-side filtered items --- .../navigation-panel/menus/content-categories.js | 6 +++++- .../navigation-panel/menus/content-pages.js | 2 +- .../navigation-panel/menus/content-posts.js | 2 +- .../navigation-sidebar/navigation-panel/search-results.js | 6 +++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-categories.js b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-categories.js index f201837e87a580..223ac589e3a524 100644 --- a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-categories.js +++ b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-categories.js @@ -63,7 +63,11 @@ export default function ContentCategoriesMenu() { isSearchDebouncing={ isDebouncing || ! isResolved } > { search && ! isDebouncing && ( - + ) } { ! search && diff --git a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-pages.js b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-pages.js index 36bfc18e8adbf9..640319a95b704d 100644 --- a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-pages.js +++ b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-pages.js @@ -63,7 +63,7 @@ export default function ContentPagesMenu() { isSearchDebouncing={ isDebouncing || ! isResolved } > { search && ! isDebouncing && ( - + ) } { ! search && diff --git a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-posts.js b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-posts.js index 3c3c146deaa732..44aa09179c365e 100644 --- a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-posts.js +++ b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/menus/content-posts.js @@ -81,7 +81,7 @@ export default function ContentPostsMenu() { isSearchDebouncing={ isDebouncing || ! isResolved } > { search && ! isDebouncing && ( - + ) } { ! search && ( diff --git a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/search-results.js b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/search-results.js index fbb21151021a11..c0c6dff7eec6f9 100644 --- a/packages/edit-site/src/components/navigation-sidebar/navigation-panel/search-results.js +++ b/packages/edit-site/src/components/navigation-sidebar/navigation-panel/search-results.js @@ -18,7 +18,7 @@ import { useSelect } from '@wordpress/data'; import TemplateNavigationItem from './template-navigation-item'; import ContentNavigationItem from './content-navigation-item'; -export default function SearchResults( { items, search } ) { +export default function SearchResults( { items, search, noFilter } ) { let itemType = null; if ( items?.length > 0 ) { if ( items[ 0 ].taxonomy ) { @@ -70,6 +70,10 @@ export default function SearchResults( { items, search } ) { return []; } + if ( ! noFilter ) { + return items; + } + return items.filter( ( { slug } ) => { const { title, description } = itemInfosMap[ slug ];