From de1dca620a88b1cec2b408bbe27b67aacd72c355 Mon Sep 17 00:00:00 2001 From: Yoshimi_Shima Date: Mon, 12 Aug 2024 02:58:20 +0900 Subject: [PATCH] fix(#834): Do not refresh on window focus for unprotected pages (#858) --- src/runtime/utils/refreshHandler.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/utils/refreshHandler.ts b/src/runtime/utils/refreshHandler.ts index 17ef56d4..5b8835f1 100644 --- a/src/runtime/utils/refreshHandler.ts +++ b/src/runtime/utils/refreshHandler.ts @@ -73,8 +73,8 @@ export class DefaultRefreshHandler implements RefreshHandler { // Listen for when the page is visible, if the user switches tabs // and makes our tab visible again, re-fetch the session, but only if // this feature is not disabled. - if (this.config?.enableOnWindowFocus && document.visibilityState === 'visible') { - this.auth?.refresh() + if (this.config?.enableOnWindowFocus && document.visibilityState === 'visible' && this.auth?.data.value) { + this.auth.refresh() } } }