diff --git a/src/components/image/ImageWithFallback.tsx b/src/components/image/ImageWithFallback.tsx index 319de3fd..debb985f 100644 --- a/src/components/image/ImageWithFallback.tsx +++ b/src/components/image/ImageWithFallback.tsx @@ -32,15 +32,10 @@ export default function ImageWithFallback({ const imgRef = useRef(null); useEffect(() => { - const timeout = setTimeout( - // Prevent blank flash by waiting for image to load - () => setWasCached( - Boolean(imgRef.current?.complete) && - (imgRef.current?.naturalWidth ?? 0) > 0, - ), - 50, + setWasCached( + Boolean(imgRef.current?.complete) && + (imgRef.current?.naturalWidth ?? 0) > 0, ); - return () => clearTimeout(timeout); }, []); useEffect(() => { @@ -108,4 +103,4 @@ export default function ImageWithFallback({ ); -} \ No newline at end of file +} diff --git a/src/state/AppStateProvider.tsx b/src/state/AppStateProvider.tsx index 79023db7..1368ac58 100644 --- a/src/state/AppStateProvider.tsx +++ b/src/state/AppStateProvider.tsx @@ -27,6 +27,7 @@ import { INITIAL_UPLOAD_STATE, UploadState } from '@/admin/upload'; import { RecipeProps } from '@/recipe'; import { getCountsForCategoriesCachedAction } from '@/category/actions'; import { nanoid } from 'nanoid'; +import { toastSuccess } from '@/toast'; export default function AppStateProvider({ children, @@ -169,7 +170,11 @@ export default function AppStateProvider({ setUserEmail(undefined); setUserEmailEager(undefined); clearAuthEmailCookie(); - if (isPathProtected(pathname)) { router.push(PATH_ROOT); } + if (isPathProtected(pathname)) { + router.push(PATH_ROOT); + } else { + toastSuccess('Signed out'); + } }, [router, pathname]); // Returns false when upload is cancelled