-
Notifications
You must be signed in to change notification settings - Fork 280
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
perf: added error Handling for homepage component #9
Conversation
It introduces error handling for useCurrentUser errors, adds a loading state, implements an authentication redirect, and improves code organization.
Thank you for following the naming conventions! 🙏 |
if (error) { | ||
setErrorMessage('An error occurred while fetching user data. Please try again later.') | ||
} | ||
|
||
if (user && !isLoading) { | ||
router.replace('/dashboard') | ||
} | ||
|
||
if (!user && !isLoading) { |
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.
Hi @HarshMN2345
Thanks for contributing 😄.
This is the homepage as we would like a Landing page here. We don't want to redirect the user to /dashboard
.
Also, the dashboard is at app.localhost:3000/dashboard
subdomain 😄
But great code 🎉
Also please mention #issue-number in description ✨ |
@HarshMN2345 Please update the issue number, You have mentioned wrong issue number |
Hey there, there is a merge conflict, can you take a look? |
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.
There are so many bugs in the code so closing the PR
It introduces error handling for useCurrentUser errors, adds a loading state, implements an authentication redirect, and improves code organization.