Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 15, 2026

Fix Homepage Authentication Redirect Experience

Changes Summary

  • Analyze current homepage and authentication flow
  • Update isAuthenticated hook to use local session check for faster authentication
  • Modify HomePage component to show "Redirecting..." when authenticated
  • Keep button in loading state during redirect
  • Test the build to ensure no compilation errors
  • Run linter to ensure code quality (no new issues introduced)
  • Update .gitignore to exclude build artifacts
  • Address code review feedback (remove duplicate navigation, simplify disabled state)
  • Run security scan with CodeQL (no vulnerabilities found)
  • Address PR review comments:
    • Updated duplicate isAuthenticated function in useAuth.tsx to use getSession() for consistency
    • Changed loading text from empty string to "Loading..." for better UX during initial auth check

Implementation Details

Problem: Logged-in users experienced a confusing redirect flow with the button transitioning through multiple states (loading → "View your pages" → redirect).

Solution:

  1. Faster auth check: Changed from getUser() to getSession() for instant local session validation
  2. Better UX: Button now shows "Loading..." during auth check and "Redirecting..." during navigation
  3. Consistency: Updated all isAuthenticated implementations to use the same approach

Files Modified:

  • src/hooks/isAuthenticated.tsx: Use local session check
  • src/hooks/useAuth.tsx: Updated duplicate function for consistency
  • src/views/HomePage.tsx: Add redirecting state with proper loading indicators
  • .gitignore: Exclude TypeScript build artifacts
Original prompt

Right now when a user is logged in and they go to the homepage we automatically redirect them, but it takes a second. And for the user it can be confusing cause the view pages button is in a loading state and then eventually it just says view pages and then redriects them. So can we make it so once we know the user is logged in, that button stays in loading state and says redirecting... also the redirecting takes a really long time so how can we make it quicker


✨ 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 the isAuthenticated function to use supabase.auth.getSession() for faster local session validation, checking for data.session to determine authentication status.
  • src/views/HomePage.tsx: Introduced an isRedirecting state 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 duplicate isAuthenticated function was updated to use supabase.auth.getSession() for consistency and faster local authentication, verifying data.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

@vercel
Copy link
Contributor

vercel bot commented Jan 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
draw Ready Ready Preview, Comment Jan 15, 2026 9:19pm

@coderabbitai
Copy link

coderabbitai bot commented Jan 15, 2026

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit 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 @coderabbitai help to get the list of available commands and usage tips.

Copilot AI and others added 2 commits January 15, 2026 20:38
…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>
Copilot AI changed the title [WIP] Enhance homepage redirect behavior for logged-in users Optimize homepage redirect UX with local session check and redirecting state Jan 15, 2026
Copilot AI requested a review from notkainoa January 15, 2026 20:45
Copy link

Copilot AI left a 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() with getSession() for instant local authentication checks
  • Added redirecting state management to keep the button in a loading state with "Redirecting..." text during navigation
  • Updated .gitignore to 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 by isRedirecting. This means users can still click the button while redirecting is in progress, potentially triggering the action function multiple times. The disabled prop should include isRedirecting to prevent this: disabled={loadingTimeout || isRedirecting}.
            disabled={loadingTimeout}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@notkainoa
Copy link
Owner

@copilot apply changes based on the comments in this thread

…improve loading text

Co-authored-by: notkainoa <123281048+notkainoa@users.noreply.github.com>
@notkainoa
Copy link
Owner

@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

Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@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 ...

Comprehensive review complete ✅

Changes verified:

  • ✅ Both isAuthenticated implementations use consistent getSession() approach (fast local check)
  • ✅ HomePage button shows clear states: "Loading..." → "Redirecting..."
  • ✅ Removed redundant navigation logic
  • ✅ Build passes without errors
  • ✅ Lint shows no new issues (32 pre-existing unrelated issues)
  • ✅ CodeQL security scan: 0 vulnerabilities
  • ✅ .gitignore updated to exclude build artifacts

Edge cases checked:

  • Timeout handling: ✅ Preserved 10-second timeout logic
  • Error handling: ✅ Maintains error logging
  • Type safety: ✅ Build completes successfully
  • Consistency: ✅ All auth checks use same implementation

Ready to merge. No issues, inconsistencies, or missing items found.

@notkainoa notkainoa marked this pull request as ready for review January 15, 2026 21:35
@notkainoa notkainoa merged commit da3ec96 into main Jan 15, 2026
4 of 5 checks passed
@notkainoa notkainoa deleted the copilot/update-homepage-redirect-behavior branch January 15, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants