Skip to content

Commit de1dca6

Browse files
authored
fix(#834): Do not refresh on window focus for unprotected pages (#858)
1 parent 7f366f0 commit de1dca6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/runtime/utils/refreshHandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ export class DefaultRefreshHandler implements RefreshHandler {
7373
// Listen for when the page is visible, if the user switches tabs
7474
// and makes our tab visible again, re-fetch the session, but only if
7575
// this feature is not disabled.
76-
if (this.config?.enableOnWindowFocus && document.visibilityState === 'visible') {
77-
this.auth?.refresh()
76+
if (this.config?.enableOnWindowFocus && document.visibilityState === 'visible' && this.auth?.data.value) {
77+
this.auth.refresh()
7878
}
7979
}
8080
}

0 commit comments

Comments
 (0)