From 23fe064db1a56f0dade454d9330907d71158e8d5 Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Thu, 2 May 2024 15:51:37 -0500 Subject: [PATCH] trim query to prevent redundant search on empty query --- client/src/components/Panels/Common/ToolSearch.vue | 2 +- client/src/components/Panels/ToolBox.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/components/Panels/Common/ToolSearch.vue b/client/src/components/Panels/Common/ToolSearch.vue index 31592c803dc9..f38b48c6a09e 100644 --- a/client/src/components/Panels/Common/ToolSearch.vue +++ b/client/src/components/Panels/Common/ToolSearch.vue @@ -154,7 +154,7 @@ watch( function checkQuery(q: string) { emit("onQuery", q); - if (q && q.length >= MIN_QUERY_LENGTH) { + if (q.trim() && q.trim().length >= MIN_QUERY_LENGTH) { if (FAVORITES.includes(q)) { post({ type: "favoriteTools" }); } else { diff --git a/client/src/components/Panels/ToolBox.vue b/client/src/components/Panels/ToolBox.vue index 7b0439cf8784..d87402f24207 100644 --- a/client/src/components/Panels/ToolBox.vue +++ b/client/src/components/Panels/ToolBox.vue @@ -64,7 +64,7 @@ const propShowAdvanced = computed({ }); const query = computed({ get: () => { - return props.panelQuery; + return props.panelQuery.trim(); }, set: (q: string) => { queryPending.value = true;