From df8d1d4f3d64b9b1240905c27bbb8543b0f0e911 Mon Sep 17 00:00:00 2001 From: KidLoveToPlay <63667585+Yamico@users.noreply.github.com> Date: Mon, 9 Jun 2025 22:13:39 +0800 Subject: [PATCH] fix: trim queryText and split by regex (#4766) --- web/src/components/SearchBar.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/src/components/SearchBar.tsx b/web/src/components/SearchBar.tsx index 8e7cf04a7..9f0209d44 100644 --- a/web/src/components/SearchBar.tsx +++ b/web/src/components/SearchBar.tsx @@ -17,8 +17,9 @@ const SearchBar = observer(() => { const onKeyDown = (e: React.KeyboardEvent) => { if (e.key === "Enter") { e.preventDefault(); - if (queryText !== "") { - const words = queryText.split(" "); + const trimmedText = queryText.trim(); + if (trimmedText !== "") { + const words = trimmedText.split(/\s+/); words.forEach((word) => { memoFilterStore.addFilter({ factor: "contentSearch",