Closed solderq35 closed 3 weeks ago
Demo Vid: https://youtube.com/shorts/e6q_DAK7Q_g
Timeout didn't quite work so just clicked "join team" twice I think
TODO:
I think the current changes in Auth.js are extraneous and can be removed
Find a better way to update currentUser.emailVerified
Maybe onAuthStateChanged?
New Demo Vid: https://youtu.be/yzMtmMPuigU
Intended Workflow: New User signs up (email verification sent) > User taps "Join Team" button (or taps "Resend Verification Email" if needed) > User is logged into the app and redirected to homescreen (onIdTokenChanged
asynchronously watches for when the email is verified on the user server side)
PS does the "join team" and "resend email verification" buttons need debouncing? I noticed that "join team" seemed to trigger multiple times sometimes (like 3 times in a row rapidly, hence janky navigation after tapping "join team" button).
PS does the "join team" and "resend email verification" buttons need debouncing? I noticed that "join team" seemed to trigger multiple times sometimes (like 3 times in a row rapidly, hence janky navigation after tapping "join team" button).
Yes, and it will be addressed in either debounce 2 (if simple) or debounce-n (if complex) once this PR is merged
What is your plan to add button spinners for all of this PR's operations?
What is your plan to add button spinners for all of this PR's operations?
Assuming that "Join Team" button is hidden to user until email is verified, I guess we could make the "Resend Verification Email" button show a spinner animation until the email is finished sending?
For verified users, I suppose the "Join Team" button could show a spinner animation until all async operations were awaited (firestore operations etc)
Ye it took a very long time for me when I tested it. It's helpful to know that the app received my input and is doing work instead of just trusting it.
Fixed the below signout error (see screenshot), although not sure if this will cause excess re renders etc, maybe there is better solution.
Kind of got loading spinner working for sending verification email, and also kind of fixed bug where it was inconsistent if the new user would be directed to chooseTeam screen upon signup.
TODO:
auth.currentUser.emailVerified
as it seems to work more reliably (given persistent login credentials)you gotta set the "textColor" for the spinner to change
Changed spinner color to white:
I removed the dependency array from the unregisterAuthObserver
useEffect due to it bugging out.
Basically you need to call user.reload()
in order for the updated status to register. If you also put auth.currentUser
(or whatever) in the useEffect dependency array, it causes an infinite feedback loop.
So now it does work but the user has to manually pulldown to refresh after they verified email
Maybe helpful for the useEffect / emailVerified / onIdTokenChanged issue:
I think the useEffect works as intended now (it automatically detects when you verified email and then shows "Join Team" button afterwards).
To resolve the issues mentioned in my previous comment, I had to set up a setInterval to reload the user and check for updates every 10 seconds.
Demo Video (read Youtube video description): https://youtu.be/KpHN71xhFfE
PS: I tried putting showSnackBar
in the useEffect dependency Array, but it caused the "Email successfully verified" popup to not go away for some reason later, especially if I had waited about 20 or 30 seconds after signup to verify email.
So I am leaving it out of the dependency array for now.
Had to change the context/Auth.js
useEffect from onAuthStateChanged
to onIdTokenChanged
in order to get currentUserVerified
/ setCurrentUserVerified
to work as intended. Hopefully that doesn't cause too many re renders etc.
When joining new team