From 940eef458f6290fb4c19d4b53520315325e60d14 Mon Sep 17 00:00:00 2001 From: spencerwooo Date: Sat, 29 Jan 2022 15:11:05 +0800 Subject: [PATCH] disable file listing revalidate, close #317 --- utils/fetchWithSWR.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/utils/fetchWithSWR.ts b/utils/fetchWithSWR.ts index a7f1ac4..1590935 100644 --- a/utils/fetchWithSWR.ts +++ b/utils/fetchWithSWR.ts @@ -60,11 +60,11 @@ export function useProtectedSWRInfinite(path: string = '') { return [`/api?path=${path}&next=${previousPageData.next}`, hashedToken] } - // const revalidationOptions = { - // revalidateOnMount: !(cache.has(`arg@"/api?path=${path}"@null`) || cache.has(`/api?path=${path}`)), - // revalidateOnFocus: false, - // revalidateOnReconnect: true, - // } - // return useSWRInfinite(getNextKey, fetcher, revalidationOptions) - return useSWRInfinite(getNextKey, fetcher) + const revalidationOptions = { + revalidateOnMount: !(cache.has(`arg@"/api?path=${path}"@null`) || cache.has(`/api?path=${path}`)), + revalidateOnFocus: false, + revalidateOnReconnect: true, + } + // return useSWRInfinite(getNextKey, fetcher) + return useSWRInfinite(getNextKey, fetcher, revalidationOptions) }