From c96e0f58a5aa87afa088f54306210c3b5d68f27c Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Fri, 26 Apr 2024 19:20:06 -0500 Subject: [PATCH] Aggressively invalidate when logged in --- src/photo/InfinitePhotoScroll.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/photo/InfinitePhotoScroll.tsx b/src/photo/InfinitePhotoScroll.tsx index 4953645a..eab5c664 100644 --- a/src/photo/InfinitePhotoScroll.tsx +++ b/src/photo/InfinitePhotoScroll.tsx @@ -31,7 +31,7 @@ export default function InfinitePhotoScroll({ triggerOnView?: boolean debug?: boolean }) { - const { swrTimestamp } = useAppState(); + const { swrTimestamp, isUserSignedIn } = useAppState(); const key = `${swrTimestamp}-${type}`; @@ -52,7 +52,12 @@ export default function InfinitePhotoScroll({ useSwrInfinite( keyGenerator, fetcher, - { revalidateFirstPage: false }, + { + revalidateFirstPage: Boolean(isUserSignedIn), + revalidateOnMount: Boolean(isUserSignedIn), + revalidateOnFocus: Boolean(isUserSignedIn), + revalidateOnReconnect: Boolean(isUserSignedIn), + }, ); const buttonContainerRef = useRef(null);