Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: clear search input val when navigate to other page

shuai4bfa98df6c2b
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';