From 4bfa98df6c2b65bec30bd5b6e888a84afb96b867 Mon Sep 17 00:00:00 2001 From: shuai Date: Tue, 4 Jul 2023 17:10:20 +0800 Subject: [PATCH] fix: clear search input val when navigate to other page --- ui/src/components/Header/index.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/src/components/Header/index.tsx b/ui/src/components/Header/index.tsx index 6adab236..3b44a470 100644 --- a/ui/src/components/Header/index.tsx +++ b/ui/src/components/Header/index.tsx @@ -95,6 +95,11 @@ const Header: FC = () => { toggle?.click(); } } + + // clear search input when navigate to other page + if (location.pathname !== '/search' && searchStr) { + setSearch(''); + } }, [location.pathname]); let navbarStyle = 'theme-colored';