From 1525a21319a5952fbc414ed0006c5a645f90a20b Mon Sep 17 00:00:00 2001 From: Cameron Matheson Date: Thu, 29 Aug 2024 14:53:10 -0600 Subject: [PATCH] preserve authkitClientState in `refreshSession` --- src/create-client.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/create-client.ts b/src/create-client.ts index 8f9e31b..b486296 100644 --- a/src/create-client.ts +++ b/src/create-client.ts @@ -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);