From a11cde1afca7f48c0ff146227d69878a98c75481 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 21 Feb 2026 22:29:04 +0100 Subject: [PATCH] fix: correct broken throttle in checkAuth that never triggered The throttle checked `lastUserInfoRefresh > now + 1 minute` which is never true since lastUserInfoRefresh is set to the current time. Changed to `now - 1 minute` so the check actually prevents redundant API calls within a one-minute window. --- frontend/src/stores/auth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/stores/auth.ts b/frontend/src/stores/auth.ts index a947b2ab1..12049c38e 100644 --- a/frontend/src/stores/auth.ts +++ b/frontend/src/stores/auth.ts @@ -272,12 +272,12 @@ export const useAuthStore = defineStore('auth', () => { */ async function checkAuth() { const now = new Date() - const inOneMinute = new Date(new Date().setMinutes(now.getMinutes() + 1)) + const oneMinuteAgo = new Date(new Date().setMinutes(now.getMinutes() - 1)) // This function can be called from multiple places at the same time and shortly after one another. // To prevent hitting the api too frequently or race conditions, we check at most once per minute. if ( lastUserInfoRefresh.value !== null && - lastUserInfoRefresh.value > inOneMinute + lastUserInfoRefresh.value > oneMinuteAgo ) { return }