From cbcff3e56dac79ad79da6e8a12d00cb7df010263 Mon Sep 17 00:00:00 2001 From: Jessica Chowdhury Date: Thu, 13 Nov 2025 15:47:17 +0000 Subject: [PATCH 1/2] fix: logout loading gets stuck when inactivity and isLoggedIn are true --- packages/next/src/views/Logout/LogoutClient.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/next/src/views/Logout/LogoutClient.tsx b/packages/next/src/views/Logout/LogoutClient.tsx index 6a74a32f65b..673d53ebe4d 100644 --- a/packages/next/src/views/Logout/LogoutClient.tsx +++ b/packages/next/src/views/Logout/LogoutClient.tsx @@ -67,13 +67,13 @@ export const LogoutClient: React.FC<{ }, [inactivity, logOut, loginRoute, router, startRouteTransition, t]) useEffect(() => { - if (isLoggedIn) { + if (isLoggedIn && !inactivity) { void handleLogOut() } else if (!navigatingToLoginRef.current) { navigatingToLoginRef.current = true startRouteTransition(() => router.push(loginRoute)) } - }, [handleLogOut, isLoggedIn, loginRoute, router, startRouteTransition]) + }, [handleLogOut, isLoggedIn, loginRoute, router, startRouteTransition, inactivity]) if (!isLoggedIn && inactivity) { return ( From 912073e9cffb05b544265c3bf34d92c076fd19ac Mon Sep 17 00:00:00 2001 From: Jessica Chowdhury Date: Thu, 13 Nov 2025 16:24:03 +0000 Subject: [PATCH 2/2] chore: move inactivity check before logout is called --- packages/next/src/views/Logout/LogoutClient.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/next/src/views/Logout/LogoutClient.tsx b/packages/next/src/views/Logout/LogoutClient.tsx index 673d53ebe4d..bf21e5c07a7 100644 --- a/packages/next/src/views/Logout/LogoutClient.tsx +++ b/packages/next/src/views/Logout/LogoutClient.tsx @@ -45,11 +45,10 @@ export const LogoutClient: React.FC<{ const [loginRoute] = React.useState(() => formatAdminURL({ adminRoute, - path: `/login${ - inactivity && redirect && redirect.length > 0 + path: `/login${inactivity && redirect && redirect.length > 0 ? `?redirect=${encodeURIComponent(redirect)}` : '' - }`, + }`, }), ) @@ -57,14 +56,14 @@ export const LogoutClient: React.FC<{ const router = useRouter() const handleLogOut = React.useCallback(async () => { - if (!inactivity && !navigatingToLoginRef.current) { + if (!navigatingToLoginRef.current) { navigatingToLoginRef.current = true await logOut() toast.success(t('authentication:loggedOutSuccessfully')) startRouteTransition(() => router.push(loginRoute)) return } - }, [inactivity, logOut, loginRoute, router, startRouteTransition, t]) + }, [logOut, loginRoute, router, startRouteTransition, t]) useEffect(() => { if (isLoggedIn && !inactivity) {