Skip to content

Commit

Permalink
feat: add warning for multiple instances in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
hf committed Jun 27, 2023
1 parent 3353632 commit 33ac042
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/GoTrueClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ export default class GoTrueClient {
this.instanceID = GoTrueClient.nextInstanceID
GoTrueClient.nextInstanceID += 1

if (this.instanceID > 0 && isBrowser()) {
console.warn(
'Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.'
)
}

const settings = { ...DEFAULT_OPTIONS, ...options }
this.logDebugMessages = settings.debug
this.inMemorySession = null
Expand Down

0 comments on commit 33ac042

Please sign in to comment.