polymerfire: Firebase auth properties are not updated on user profile change
Description
Firebase auth properties are not updated when user data are changed following a call to this.user.updateProfile, this.user.updateEmail, etc.
Expected outcome
Firebase auth properties value reflect the last changes.
Actual outcome
Firebase auth properties value remains the same as before an update. A full page reload is required to get fresh values.
Steps to reproduce
- Make use of
firebase-authcustom element:
<firebase-auth id="auth" user="{{user}}"></firebase-auth>
- In your custom element template, include the user display name data binding:
Username: [[user.displayName]]
- Create an action (triggered for instance upon a tap on a button) that changes the current user display name as follows:
this.user.updateProfile({displayName: 'What a fail!'});
When the button is tapped, your page should display Username: What a fail! but it does not. The old value remains.
I was thinking about something related to how dirty checking is working with Polymer. As a consequence, I tried to force the update manually:
this.set('user.displayName', newFullName);
Unfortunately, this fails with the following error:
Cannot assign to read only property ‘displayName’ of object…
Indeed, if I look at the implementation of firebase-auth.html, the property user is defined as readOnly.
I am still looking for a solution or a temporary workaround.
Browsers Affected
- Chrome
- Firefox
- Safari 9
- Safari 8
- Safari 7
- Edge
- IE 11
- IE 10
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 1
- Comments: 22 (3 by maintainers)
I believe this is still an issue.
I have authenticated using Google Play Games. I have a message in my game that says, “Welcome <FirebaseAuth.CurrentUser.DisplayName>!” (essentially that). When I change the name of this user in their Google Play Games profile, subsequent plays of the game (it has now been over a week) still display the user’s old display name.
I have tried using “FirebaseAuth.CurrentUser.ReloadAsync()” and that doesn’t seem to have “refreshed” the user’s details as it is documented to do.
I will try some more playing around and edit my post here if I find anything.
Edit: Using “Social.localUser.userName” displays the new username. 👍
You are completely right. I missed that info in the README. Thanks for the prompt response.
@ChARCOOL @ashcrok unfortunately this will be an issue in 2022 as well … to quote the README
I don’t mean to come off as harsh but I want to set your expectations properly. You should not use polymerfire and you should not expect it to improve. There are likely other good Firebase+Polymer libraries out there but this isn’t one of them.
Holy moly dude, this bug still exists in Jan 19, 2021, unbelievable.