Skip to content
New issue

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

createUserProfileDocument in firebase is fired twice #8

Open
jazkh opened this issue Mar 12, 2020 · 1 comment
Open

createUserProfileDocument in firebase is fired twice #8

jazkh opened this issue Mar 12, 2020 · 1 comment

Comments

@jazkh
Copy link

jazkh commented Mar 12, 2020

Hello,
Why does createUserProfileDocument funcion in firebase is fired twice whenever a new user signs up?
It looks like a bug to me because this code seems to be in some kind of race condition. Why do we need to update firebase twice just to add displayName?

You will see that snapShot.exists in firebase is always false when the function is called from both App.js and SignUp component simultaneously.

I think both Sign In and Sign Up should have seperate createUserProfileDocument code.

Secondly, this.setState is not fired in handleSubmit to empty the state inside Sign Up component because Sign Up is already unmounted.

@jazkh
Copy link
Author

jazkh commented Mar 12, 2020

@ZhangMYihua please share your thoughts as it is very confusing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant