From 3b92268a4012aa1a6684254d18c378eae00aa249 Mon Sep 17 00:00:00 2001 From: Haoqing Wang <78337154+hqhq1025@users.noreply.github.com> Date: Sat, 11 Apr 2026 22:12:20 +0800 Subject: [PATCH] fix(web): restore conditional TTL guard on visibility refresh (#443) The forced refresh added in #442 triggers a full /api/auth round-trip on every tab focus/visibility event. Since the JWT lifetime is now 4 hours, the original minTtlMs guard (refresh only when <60s remains) is sufficient and avoids unnecessary auth traffic. --- web/src/hooks/useAuth.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/hooks/useAuth.ts b/web/src/hooks/useAuth.ts index 66343c9f..054ced5a 100644 --- a/web/src/hooks/useAuth.ts +++ b/web/src/hooks/useAuth.ts @@ -267,7 +267,7 @@ export function useAuth(authSource: AuthSource | null, baseUrl: string): { } const handleActive = () => { - void refreshAuth({ force: true }) + void refreshAuth({ minTtlMs: 60_000 }) } const handleVisibilityChange = () => {