Skip to content

Commit

Permalink
fix(web): reset search bar input
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Oct 4, 2024
1 parent 6c1481c commit 8164b73
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apps/frontend/web/app/components/Search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { useActiveElement, useDocument, useEventListener } from '@/hooks';

import './cmdk.css';

import { DMHY_RE, debounce, parseSearch, resolveSearchURL } from './utils';
import { DMHY_RE, debounce, parseSearch, resolveSearchURL, stringifySearch } from './utils';

const SEARCH_HELP_URL = `https://animespace.onekuma.cn/animegarden/search.html`;

Expand Down Expand Up @@ -50,7 +50,8 @@ export const Search = memo(() => {

useEffect(() => {
if (location.state?.trigger !== 'search') {
setInput('');
const content = stringifySearch(new URLSearchParams(location.search));
setInput(content);
}
}, [location]);

Expand Down

0 comments on commit 8164b73

Please sign in to comment.