Skip to content

Fix auth loading state getting stuck on protected routes#82

Merged
fuzziecoder merged 1 commit intocodex/fix-remaining-issues-and-raise-prfrom
codex/fix-loading-issue
Feb 24, 2026
Merged

Fix auth loading state getting stuck on protected routes#82
fuzziecoder merged 1 commit intocodex/fix-remaining-issues-and-raise-prfrom
codex/fix-loading-issue

Conversation

@fuzziecoder
Copy link
Copy Markdown
Owner

@fuzziecoder fuzziecoder commented Feb 24, 2026

Motivation

  • The app's protected routes could remain stuck showing Loading... when the initial Supabase session retrieval hangs or never resolves. This causes poor UX on login-protected pages.

Description

  • Updated src/hooks/useAuth.ts to add a 5-second fallback timeout that clears the loading state if session init hangs by using window.setTimeout and setLoading(false).
  • Hardened the initial supabase.auth.getSession() call with then/catch/finally so session fetch failures still result in loading being resolved.
  • Added an isMounted guard and ensured cleanup of the timeout and Supabase subscription on unmount to prevent stale state updates and memory leaks.

Testing

  • Ran npm run build in the project root and the production build completed successfully without errors.

Codex Task


Open with Devin

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 24, 2026

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

Project Deployment Actions Updated (UTC)
flexi-roaster Ready Ready Preview, Comment Feb 24, 2026 3:07pm

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@fuzziecoder fuzziecoder merged commit 183adf0 into codex/fix-remaining-issues-and-raise-pr Feb 24, 2026
6 of 7 checks passed
@fuzziecoder fuzziecoder added hard and removed medium labels Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant