-
Notifications
You must be signed in to change notification settings - Fork 24
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
IRO-1307 - Address UI lag in rendering Magic Link state #126
Conversation
IRO-1307 Figure out why the page renders before the magic link data hooks
Our Toast says 'welcome back' but the other parts of the UI don't know you're logged in until a refresh. It's lame. |
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/ironfish/website-testnet/CVXhyaV2mc8EXw4tnmDWSCMiG46S |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work as expected. When logging out, after the redirect happens, the Login page appear to be logged out, but if you click on Leaderboard, the navbar appears to be logged in again.
The source of the issue is the multiple instances of useLogin
created by useProtectedRoute
. The site only needs one source of truth for whether the user is logged in or not, so we can centralize that in the single useLogin
in _app.tsx
. useLogin
should either contain all of the auth logic and export functions to control it, or export functions to control its state so that e.g. logout can clear the state and the login callback can update or trigger a reload of the state.
The use of Context is irrelevant to fixing this issue, but I'm not opposed to prop-drilling since there aren't too many components in the component tree anyway.
Yeah, you're right. I'm not sure when I made that mistake but that's correct. Will try to address this morning. |
pages/_app
directly. This ends up being both more reliable and ultimately more readable / easier to reason about.useRouter
instead ofRouter.push