Skip to content

Commit e368012

Browse files
authored
fix(auth): return currentUser directly from the native instance (#69)
1 parent 18abb4b commit e368012

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

packages/firebase-auth/index.android.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,12 +1425,8 @@ export class Auth implements IAuth {
14251425
return this.#app;
14261426
}
14271427

1428-
#user: User;
14291428
get currentUser(): User {
1430-
if (!this.#user) {
1431-
this.#user = User.fromNative(this.native.getCurrentUser());
1432-
}
1433-
return this.#user;
1429+
return this.native ? User.fromNative(this.native.getCurrentUser()) : null;
14341430
}
14351431

14361432
get languageCode(): string {

packages/firebase-auth/index.ios.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,12 +1247,8 @@ export class Auth implements IAuth {
12471247
return this.#app;
12481248
}
12491249

1250-
#user: User;
12511250
get currentUser(): User {
1252-
if (!this.#user) {
1253-
this.#user = User.fromNative(this.native.currentUser);
1254-
}
1255-
return this.#user;
1251+
return this.native ? User.fromNative(this.native.currentUser) : null;
12561252
}
12571253

12581254
get languageCode(): string {

0 commit comments

Comments
 (0)