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

onAuthStateChanged #1

Open
Gallevy opened this issue Dec 18, 2017 · 1 comment
Open

onAuthStateChanged #1

Gallevy opened this issue Dec 18, 2017 · 1 comment
Labels

Comments

@Gallevy
Copy link

Gallevy commented Dec 18, 2017

First of all, very good sample, But why do you register to onAuthStateChanged on every component that needs permission(withAuthorization), Shouldn't that be handled differently since you already listen to it in the withAuthentication component

@rwieruch
Copy link
Member

Hey. Thank you for reaching out. I would say it is semi optimal. It's not that you should wire every component to withAuthorization. My feeling is that it should happen on the top layer and thus you would listen two times on firebase changes for the auth user: withAuthentication & withAuthorization. Since the authUser shouldn't change often, only for sign up, sign in and sign out, I would say it is a minor performance problem. But I get your point here!

Would you want to propose a different solution in a PR in https://github.com/rwieruch/react-firebase-authentication/ (plain React Firebase) just to showcase how it could be done differently? Perhaps it would be a great opportunity for me to adjust the material :) Thanks again for reaching out.

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

No branches or pull requests

2 participants