Closed sanjayyepuri closed 4 years ago
Isn't it possible to just redirect to the home page, so that the site updates and so when they try to go to the Find a Mentor, Profile, or Speaker Series pages, the User object will have been updated unless the user has some superhuman reflexes and blazing fast internet?
This is far easier and makes more sense in my opinion than just showing them the same Profile information that they just filled out.
The issue is if you are currently on, let's say, the Profile page and hit refresh, you get redirected to the Sign In Page (with your change, the Home Page). The correct behavior, for a logged-in user, would be to stay on the same page.
I am not sure why the correct behavior is to stay on the same page, but regardless, Michael seems to have made changes. I will look over them tomorrow, but if you could as well that would be great.
This bug occurs when you navigate to a protected page (Find a Mentor, Profile, or Speaker Series pages) and hit refresh.
This is caused by a race condition that occurs between the firebase-auth callback and the page render. Essentially, the page renders before the User object is updated with the logged in user's state. This causes the ProtectedPage to see
undefined
and redirect the user toSignIn
.One possible solution is to rather than redirect to the Sign In page, we render the
SignIn
Component directly inProtectedPage
. Then, when the User object eventually gets updated, the correct page is shown to the user.