Skip to content

Commit

Permalink
fix(#834): Do not refresh on window focus for unprotected pages (#858)
Browse files Browse the repository at this point in the history
  • Loading branch information
YoshimiShima authored Aug 11, 2024
1 parent 7f366f0 commit de1dca6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime/utils/refreshHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
}

0 comments on commit de1dca6

Please sign in to comment.