From c34fa086fb50e73f738971b2b31d7e8a0cec0129 Mon Sep 17 00:00:00 2001 From: spencerwooo Date: Thu, 6 Jan 2022 21:16:20 +0800 Subject: [PATCH] no more stale swr any longer --- utils/fetchWithSWR.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/utils/fetchWithSWR.ts b/utils/fetchWithSWR.ts index b9a1b85..1f43c42 100644 --- a/utils/fetchWithSWR.ts +++ b/utils/fetchWithSWR.ts @@ -56,10 +56,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) + // 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) }