-
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
refactor(AuthContext): Refactor to TypeScript and change dir #404
Conversation
✅ Deploy Preview for cesium-seium ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
@@ -144,26 +178,25 @@ export function AuthProvider({ children }) { | |||
setRefetch((needsRefetch) => !needsRefetch); | |||
} | |||
|
|||
// Make the provider update only when it should |
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.
I've deleted this useMemo because it's generally used just for complex calcs (that is not this case).
This useMemo causes two renders, the first one because the states changed and second because the useMemo detects that someone from it's dependency array changed, causing unecessary renders.
This pull request is being automatically deployed to Netlify. |
3a07950
to
ff94232
Compare
30506ea
to
0f31eaa
Compare
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.
Don't forget to run the formatter :)
After that, I think it's good to merge (if the github actions cooperate)
0f31eaa
to
4635b10
Compare
✅ Deploy Preview for seium-stg ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
I took the opportunity of refactoring the auth context to fix an old bug logging in/out, where an error would appear in the console saying something along the lines of "Abort fetching route 'attendee/profile' ". To solve that, I added a new feature: much like blackboard, when you try to access a protected page while unauthenticated, instead of simply redirecting away, the original route is stored as a query param. That way, after the login is complete, the user is redirected to the original route. |
30f125c
to
05e16e1
Compare
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.
Looks good! 🚀
Change AuthContext from /components to /context