Skip to content

Commit

Permalink
fix(oidc-client): make locks work only ifAvailable (#1237)(alpha)
Browse files Browse the repository at this point in the history
Co-authored-by: abhilashlr <abhilashlr.789@gmail.com.com>
  • Loading branch information
abhilashlr and abhilashlr committed Dec 9, 2023
1 parent dd8fab4 commit 64a8df3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/oidc-client/src/renewTokens.ts
Expand Up @@ -34,7 +34,8 @@ export async function renewTokensAndStartTimerAsync(oidc, refreshToken, forceRef
if(configuration.storage === window.sessionStorage && !serviceWorker) {
tokens = await syncTokens(oidc, refreshToken, forceRefresh, extras);
} else {
tokens = await navigator.locks.request(lockResourcesName, async (lock) => {
tokens = await navigator.locks.request(lockResourcesName, { ifAvailable: true }, async (lock) => {
oidc.publishEvent('Lock executed', lock);
return await syncTokens(oidc, refreshToken, forceRefresh, extras);
});
}
Expand Down

0 comments on commit 64a8df3

Please sign in to comment.