diff --git a/src/app/AppViewSwitcher.tsx b/src/app/AppViewSwitcher.tsx index 93dc2547..0b3472c7 100644 --- a/src/app/AppViewSwitcher.tsx +++ b/src/app/AppViewSwitcher.tsx @@ -33,11 +33,11 @@ const GAP_CLASS = 'mr-1.5 sm:mr-2'; export default function AppViewSwitcher({ currentSelection, className, - animateSearch = true, + animate = true, }: { currentSelection?: SwitcherSelection className?: string - animateSearch?: boolean + animate?: boolean }) { const pathname = usePathname(); @@ -151,10 +151,10 @@ export default function AppViewSwitcher({ {showSortControl && @@ -172,7 +172,12 @@ export default function AppViewSwitcher({ /> } - + } diff --git a/src/app/Nav.tsx b/src/app/Nav.tsx index 6c566d39..e5ea17fb 100644 --- a/src/app/Nav.tsx +++ b/src/app/Nav.tsx @@ -20,6 +20,7 @@ import { } from './config'; import { useRef } from 'react'; import useStickyNav from './useStickyNav'; +import { useAppState } from '@/state/AppState'; const NAV_HEIGHT_CLASS = NAV_CAPTION ? 'min-h-[4rem] sm:min-h-[5rem]' @@ -37,6 +38,10 @@ export default function Nav({ const pathname = usePathname(); const showNav = !isPathSignIn(pathname); + const { + hasLoadedWithAnimations, + } = useAppState(); + const { classNameStickyContainer, classNameStickyNav, @@ -86,7 +91,7 @@ export default function Nav({
> + hasLoadedWithAnimations?: boolean swrTimestamp?: number invalidateSwr?: () => void nextPhotoAnimation?: AnimationConfig diff --git a/src/state/AppStateProvider.tsx b/src/state/AppStateProvider.tsx index 8b523893..50d81d42 100644 --- a/src/state/AppStateProvider.tsx +++ b/src/state/AppStateProvider.tsx @@ -50,6 +50,8 @@ export default function AppStateProvider({ // CORE const [hasLoaded, setHasLoaded] = useState(false); + const [hasLoadedWithAnimations, setHasLoadedWithAnimations] = + useState(false); const [swrTimestamp, setSwrTimestamp] = useState(Date.now()); const [nextPhotoAnimation, _setNextPhotoAnimation] = @@ -112,8 +114,13 @@ export default function AppStateProvider({ useState(false); useEffect(() => { - setHasLoaded?.(true); + setHasLoaded(true); storeTimezoneCookie(); + setUserEmailEager(getAuthEmailCookie()); + const timeout = setTimeout(() => { + setHasLoadedWithAnimations(true); + }, 1000); + return () => clearTimeout(timeout); }, []); const invalidateSwr = useCallback(() => setSwrTimestamp(Date.now()), []); @@ -128,9 +135,6 @@ export default function AppStateProvider({ error: authError, isLoading: isCheckingAuth, } = useSWR('getAuth', getAuthAction); - useEffect(() => { - setUserEmailEager(getAuthEmailCookie()); - }, []); useEffect(() => { if (auth === null || authError) { setUserEmail(undefined); @@ -207,7 +211,7 @@ export default function AppStateProvider({ // CORE previousPathname, hasLoaded, - setHasLoaded, + hasLoadedWithAnimations, swrTimestamp, invalidateSwr, nextPhotoAnimation,