diff --git a/apps/web/src/modules/collection/MainContent.tsx b/apps/web/src/modules/collection/MainContent.tsx index 82d12201..d40ec2e2 100644 --- a/apps/web/src/modules/collection/MainContent.tsx +++ b/apps/web/src/modules/collection/MainContent.tsx @@ -122,7 +122,9 @@ const MainContent = ({ const [keyword, setKeyword] = useState(''); const [sort, setSort] = useState(''); - + useEffect(() => { + setKeyword(''); + }, [slug, router]); const params = { ident: slug, page: 1, diff --git a/apps/web/src/modules/collection/MainHeader.tsx b/apps/web/src/modules/collection/MainHeader.tsx index 87ac0f25..13d0341f 100644 --- a/apps/web/src/modules/collection/MainHeader.tsx +++ b/apps/web/src/modules/collection/MainHeader.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import { useRouter } from 'next/router'; import { useTranslation } from 'next-i18next'; import { Collection } from '@modules/explore/type'; @@ -39,7 +39,9 @@ const MainHeader = ({ }); const collection = ident ? collectionsMap[ident] : null; const [value, setValue] = useState(keyword); - + useEffect(() => { + setValue(''); + }, [ident]); useHotkeys( 'enter', (e, he) => {