Skip to content

Commit bc6192a

Browse files
authored
fix: handle null current session with split session storage (#1071)
Due to bad typing the `null` case of a missing session when using the `userStorage` option introduced in #1023 caused a crash.
1 parent a6bd108 commit bc6192a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/GoTrueClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,9 +2153,9 @@ export default class GoTrueClient {
21532153
this._debug(debugName, 'begin')
21542154

21552155
try {
2156-
const currentSession: Session = (await getItemAsync(this.storage, this.storageKey)) as any
2156+
const currentSession = (await getItemAsync(this.storage, this.storageKey)) as Session | null
21572157

2158-
if (this.userStorage) {
2158+
if (currentSession && this.userStorage) {
21592159
let maybeUser: { user: User | null } | null = (await getItemAsync(
21602160
this.userStorage,
21612161
this.storageKey + '-user'

0 commit comments

Comments
 (0)