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() } } }