client: optimize fetch collector

This commit is contained in:
fantasticit 2022-05-27 22:02:38 +08:00
parent f317086d7a
commit 42e05bec0f
2 changed files with 6 additions and 1 deletions

View File

@ -31,6 +31,7 @@ export const getCollectedWikis = (cookie = null): Promise<IWikiWithIsMember[]> =
export const useCollectedWikis = () => { export const useCollectedWikis = () => {
const { data, error, isLoading, refetch } = useQuery(CollectorApiDefinition.wikis.client(), getCollectedWikis, { const { data, error, isLoading, refetch } = useQuery(CollectorApiDefinition.wikis.client(), getCollectedWikis, {
staleTime: 500, staleTime: 500,
enabled: false,
}); });
useEffect(() => { useEffect(() => {

View File

@ -118,7 +118,11 @@ const RecentDocs = () => {
const Page: NextPage = () => { const Page: NextPage = () => {
const [visible, toggleVisible] = useToggle(false); const [visible, toggleVisible] = useToggle(false);
const { data: staredWikis, loading, error } = useCollectedWikis(); const { data: staredWikis, loading, error, refresh } = useCollectedWikis();
useEffect(() => {
refresh();
}, [refresh]);
return ( return (
<SingleColumnLayout> <SingleColumnLayout>