From 3013111d9a29a006bb300a66d446de6b0dee81d8 Mon Sep 17 00:00:00 2001 From: Stojan Dimitrovski Date: Tue, 27 Jun 2023 11:59:36 +0200 Subject: [PATCH 1/2] feat: no persist of session with no changes in `_recoverAndRefresh` --- src/GoTrueClient.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GoTrueClient.ts b/src/GoTrueClient.ts index 0faa2f04f..80fb47100 100644 --- a/src/GoTrueClient.ts +++ b/src/GoTrueClient.ts @@ -1283,9 +1283,9 @@ export default class GoTrueClient { } } } else { - if (this.persistSession) { - await this._saveSession(currentSession) - } + // no need to persist currentSession again, as we just loaded it from + // local storage; persisting it again may overwrite a value saved by + // another lient with access to the same local storage await this._notifyAllSubscribers('SIGNED_IN', currentSession) } } catch (err) { From aa435dd1dbecd093a0d5b92c09f6311268becc01 Mon Sep 17 00:00:00 2001 From: Stojan Dimitrovski Date: Tue, 27 Jun 2023 12:38:28 +0200 Subject: [PATCH 2/2] apply suggestion from @J0 Co-authored-by: Joel Lee --- src/GoTrueClient.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GoTrueClient.ts b/src/GoTrueClient.ts index 80fb47100..5adf01b44 100644 --- a/src/GoTrueClient.ts +++ b/src/GoTrueClient.ts @@ -1285,7 +1285,7 @@ export default class GoTrueClient { } else { // no need to persist currentSession again, as we just loaded it from // local storage; persisting it again may overwrite a value saved by - // another lient with access to the same local storage + // another client with access to the same local storage await this._notifyAllSubscribers('SIGNED_IN', currentSession) } } catch (err) {