Skip to content

Commit

Permalink
preserve authkitClientState in refreshSession
Browse files Browse the repository at this point in the history
  • Loading branch information
cmatheson committed Aug 30, 2024
1 parent c6bae34 commit 306ce27
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/create-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@ export async function createClient(
_authkitClientState = "AUTHENTICATED";
setSessionData(authenticationResponse, { devMode });
_onRefresh && _onRefresh(authenticationResponse);
} else {
// couldn't acquire lock
console.warn("Couldn't acquire refresh lock");

// preserving the original state so that we can try again next time
_authkitClientState = beginningState;
}
} catch (error: unknown) {
console.error(error);
Expand Down

0 comments on commit 306ce27

Please sign in to comment.