From 8cccd55fb65bd19275427411103742e1c3d83c64 Mon Sep 17 00:00:00 2001 From: saridsa2 Date: Mon, 13 Apr 2026 10:53:52 +0530 Subject: [PATCH] =?UTF-8?q?fix:=20add=20keepalive=20to=20logout=20fetch=20?= =?UTF-8?q?=E2=80=94=20prevents=20session=20lock=20orphan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The logout POST to /auth/logout was getting cancelled when the page navigated to /login before the fetch completed. keepalive: true ensures the request survives page unload so the Redis session lock is released. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/providers/auth-provider.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/providers/auth-provider.tsx b/src/providers/auth-provider.tsx index 4254fb7..c406bd6 100644 --- a/src/providers/auth-provider.tsx +++ b/src/providers/auth-provider.tsx @@ -119,6 +119,7 @@ export const AuthProvider = ({ children }: AuthProviderProps) => { await fetch(`${apiUrl}/auth/logout`, { method: 'POST', headers: { Authorization: `Bearer ${token}` }, + keepalive: true, // survives page navigation — ensures session unlock completes signal: AbortSignal.timeout(5000), }); } catch (err) {