-
-
Notifications
You must be signed in to change notification settings - Fork 0
Optimize homepage redirect UX with local session check and redirecting state #28
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Comment |
…tate Co-authored-by: notkainoa <123281048+notkainoa@users.noreply.github.com>
Co-authored-by: notkainoa <123281048+notkainoa@users.noreply.github.com>
…d state Co-authored-by: notkainoa <123281048+notkainoa@users.noreply.github.com>
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.
Pull request overview
This PR improves the homepage redirect experience for logged-in users by replacing the slow network-based authentication check with a faster local session check, and adding visual feedback during redirection to eliminate confusing button state transitions.
Changes:
- Replaced
supabase.auth.getUser()withgetSession()for instant local authentication checks - Added redirecting state management to keep the button in a loading state with "Redirecting..." text during navigation
- Updated
.gitignoreto exclude TypeScript build info files
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/hooks/isAuthenticated.tsx | Changed from getUser() to getSession() for faster local authentication check and updated the return logic to check data.session |
| src/views/HomePage.tsx | Added isRedirecting state to maintain loading UI during navigation and refactored action function to prevent duplicate navigation |
| .gitignore | Added *.tsbuildinfo pattern to ignore TypeScript incremental build files |
| tsconfig.app.tsbuildinfo | Removed build info file (now ignored by git) |
| tsconfig.node.tsbuildinfo | Removed build info file (now ignored by git) |
Comments suppressed due to low confidence (1)
src/views/HomePage.tsx:83
- The button is only disabled by
loadingTimeout, not byisRedirecting. This means users can still click the button while redirecting is in progress, potentially triggering the action function multiple times. Thedisabledprop should includeisRedirectingto prevent this:disabled={loadingTimeout || isRedirecting}.
disabled={loadingTimeout}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot apply changes based on the comments in this thread |
…improve loading text Co-authored-by: notkainoa <123281048+notkainoa@users.noreply.github.com>
|
@copilot please review all our changes 1 more time to make sure everything is correct, there are no errors, inconsistancies, things we forgot to address, edge cases. let me know if theres anything we need to fix or if this is ready to merge |
Comprehensive review complete ✅ Changes verified:
Edge cases checked:
Ready to merge. No issues, inconsistencies, or missing items found. |
Fix Homepage Authentication Redirect Experience
Changes Summary
isAuthenticatedfunction in useAuth.tsx to usegetSession()for consistencyImplementation Details
Problem: Logged-in users experienced a confusing redirect flow with the button transitioning through multiple states (loading → "View your pages" → redirect).
Solution:
getUser()togetSession()for instant local session validationisAuthenticatedimplementations to use the same approachFiles Modified:
src/hooks/isAuthenticated.tsx: Use local session checksrc/hooks/useAuth.tsx: Updated duplicate function for consistencysrc/views/HomePage.tsx: Add redirecting state with proper loading indicators.gitignore: Exclude TypeScript build artifactsOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
TL;DR
Optimized the homepage redirect experience for logged-in users by making the authentication check quicker and providing clear UI feedback during the redirection process.
What changed?
src/hooks/isAuthenticated.tsx: Refactored theisAuthenticatedfunction to usesupabase.auth.getSession()for faster local session validation, checking fordata.sessionto determine authentication status.src/views/HomePage.tsx: Introduced anisRedirectingstate to manage user redirection to/pages, ensuring the main action button displays "Redirecting..." and stays in a loading state during navigation..gitignore: Updated to include*.tsbuildinfo, excluding TypeScript incremental build information files from version control.src/hooks/useAuth.tsx: The duplicateisAuthenticatedfunction was updated to usesupabase.auth.getSession()for consistency and faster local authentication, verifyingdata.session.tsconfig.app.tsbuildinfo: Updated, indicating changes in the TypeScript project's build state or dependencies.tsconfig.node.tsbuildinfo: Updated TypeScript build info file for the Node.js environment, reflecting changes in the project's build state.Description generated by Mesa. Update settings