From 5696f428f5efa0f5593522ef9d2ff0db1a5ca0f9 Mon Sep 17 00:00:00 2001 From: ieow Date: Tue, 5 Nov 2024 12:24:22 +0800 Subject: [PATCH] fix: return early on success rehydrate --- src/mpcCoreKit.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mpcCoreKit.ts b/src/mpcCoreKit.ts index 3043df4e..ad2650fa 100644 --- a/src/mpcCoreKit.ts +++ b/src/mpcCoreKit.ts @@ -292,7 +292,8 @@ export class Web3AuthMPCCoreKit implements ICoreKit { // on failed redirect, instance is reseted. // skip check feature gating on redirection as it was check before login await this.handleRedirectResult(); - // return after redirect, the rest of the code will not be executed + + // return early on successful redirect, the rest of the code will not be executed return; } else if (params.rehydrate && this.sessionManager) { // if not redirect flow try to rehydrate session if available @@ -308,6 +309,9 @@ export class Web3AuthMPCCoreKit implements ICoreKit { // try rehydrate session if (sessionResult) { await this.rehydrateSession(sessionResult); + + // return early on success rehydration + return; } } }