From 306ce27ead963f7f2ba7becff71fc7a7564b7386 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);