Skip to content

Commit

Permalink
fix(oidc): lost session back (#1514)
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-chervet authored Feb 6, 2025
1 parent 8021990 commit 371abf5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/oidc-client/src/renewTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,17 @@ const synchroniseTokensAsync =
message: `wait because navigator is offline try ${numberTryOnline}`,
});
}
const nextIndex = index + 1;
const isDocumentHidden = document.hidden;
const nextIndex = isDocumentHidden ? index : index + 1;
if (index > 4) {
if(isDocumentHidden){

Check failure on line 222 in packages/oidc-client/src/renewTokens.ts

View workflow job for this annotation

GitHub Actions / Run linters

Replace `(isDocumentHidden)` with `·(isDocumentHidden)·`
return { tokens: oidc.tokens, status: 'GIVE_UP' };
} else {
updateTokens(null);
oidc.publishEvent(eventNames.refreshTokensAsync_error, { message: 'refresh token' });
return { tokens: null, status: 'SESSION_LOST' };
}
}
if (!extras) {
extras = {};
}
Expand Down

0 comments on commit 371abf5

Please sign in to comment.