We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When calling updateCurrentUser the code clones the UserImpl class but incorrectly clones the UserMetadata resulting in undefined values.
updateCurrentUser
undefined
Line of code calling _clone:
_clone
firebase-js-sdk/packages/auth/src/core/auth/auth_impl.ts
Line 343 in bea604e
_clone function: https://github.com/firebase/firebase-js-sdk/blob/master/packages/auth/src/core/user/user_impl.ts#L142.
The spread operator only passes keys on the UserImpl class and will not pass the Metadata properties belonging to UserMetadata. This causes https://github.com/firebase/firebase-js-sdk/blob/master/packages/auth/src/core/user/user_impl.ts#L142 to fail.
UserMetadata
This is missed in the test because the metadata properties are never set:
firebase-js-sdk/packages/auth/src/core/user/user_impl.test.ts
Line 257 in b6c231a
getAuth().updateCurrentUser(user)
console.log(getAuth().currentUser)
getAuth().updateCurrentUser(user).then(() => { console.log(getAuth().currentUser) })
_clone(auth: AuthInternal): UserInternal { return new UserImpl({ ...this, createdAt: this.metadata.creationTime, lastLoginAt: this.metadata.lastSignInTime, auth, stsTokenManager: this.stsTokenManager._clone() }); }
The text was updated successfully, but these errors were encountered:
Thanks for pointing this out! Are you able to send a PR with a fix, by any chance?
If not, we can add it to our list to fix.
Sorry, something went wrong.
Yup I can create a PR to fix the issue
No branches or pull requests
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
When calling
updateCurrentUser
the code clones the UserImpl class but incorrectly clones the UserMetadata resulting inundefined
values.Line of code calling
_clone
:firebase-js-sdk/packages/auth/src/core/auth/auth_impl.ts
Line 343 in bea604e
_clone
function: https://github.com/firebase/firebase-js-sdk/blob/master/packages/auth/src/core/user/user_impl.ts#L142.The spread operator only passes keys on the UserImpl class and will not pass the Metadata properties belonging to
UserMetadata
. This causes https://github.com/firebase/firebase-js-sdk/blob/master/packages/auth/src/core/user/user_impl.ts#L142 to fail.This is missed in the test because the metadata properties are never set:
firebase-js-sdk/packages/auth/src/core/user/user_impl.test.ts
Line 257 in b6c231a
Steps to reproduce:
getAuth().updateCurrentUser(user)
console.log(getAuth().currentUser)
and notice that the metadata fields are not undefinedRelevant Code:
Solution:
The text was updated successfully, but these errors were encountered: