From 94e5947cecbf65bffa06627142d49ffe910d751f Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Mon, 30 Mar 2026 20:06:58 +0300 Subject: [PATCH] Fix useEffect loop on 401 error --- app/components/Catcher.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/components/Catcher.tsx b/app/components/Catcher.tsx index 3e0a946be..4c243af44 100644 --- a/app/components/Catcher.tsx +++ b/app/components/Catcher.tsx @@ -24,9 +24,12 @@ export function Catcher() { const location = useLocation(); // refresh user data to make sure it's up to date (e.g. cookie might have been removed, let's show the prompt to log back in) + const hasRevalidated = React.useRef(false); React.useEffect(() => { if (!isRouteErrorResponse(error) || error.status !== 401) return; + if (hasRevalidated.current) return; + hasRevalidated.current = true; revalidate(); }, [revalidate, error]);