Skip to content

Fix auth state flash showing Sign In buttons for authenticated users#25

Merged
lAvArt merged 4 commits into
mainfrom
claude/crazy-ardinghelli
Apr 7, 2026
Merged

Fix auth state flash showing Sign In buttons for authenticated users#25
lAvArt merged 4 commits into
mainfrom
claude/crazy-ardinghelli

Conversation

@lAvArt

@lAvArt lAvArt commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Initialize AuthContext state from serverUser synchronously to prevent the Navbar from briefly showing unauthenticated UI while the client-side auth check resolves. Add loading skeleton fallback and 5s safety timeout.

lAvArt and others added 2 commits April 7, 2026 22:04
Initialize AuthContext state from serverUser synchronously to prevent
the Navbar from briefly showing unauthenticated UI while the client-side
auth check resolves. Add loading skeleton fallback and 5s safety timeout.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-in users no longer see the homepage with stale loading states.
They are server-side redirected to /insights immediately. Removed the
dead authenticated branch from the homepage JSX.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lAvArt lAvArt force-pushed the claude/crazy-ardinghelli branch from 3ab8f67 to 0c18db4 Compare April 7, 2026 19:44
lAvArt and others added 2 commits April 7, 2026 22:55
- Service worker: exclude protected routes from caching, bump cache
  version to bust stale entries, always fetch from network for
  user-specific pages (/insights, /editor, /settings, etc.)
- Middleware: add Cache-Control no-store header for protected routes
- insights/page.tsx: use useAuth() instead of redundant
  supabase.auth.getUser() — auth state resolves instantly from
  serverUser, no more loading flash
- FollowButton: consolidate two separate auth useEffects into one
  using useAuth(), eliminating race condition on isOwnProfile
- BookmarkButton: use useAuth() instead of direct Supabase auth
  calls for consistent auth state

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lAvArt lAvArt merged commit 3863c43 into main Apr 7, 2026
5 checks passed
@lAvArt lAvArt deleted the claude/crazy-ardinghelli branch April 11, 2026 17:57
lAvArt added a commit that referenced this pull request Apr 13, 2026
lAvArt added a commit that referenced this pull request Apr 13, 2026
Fix auth state flash showing Sign In buttons for authenticated users
lAvArt added a commit that referenced this pull request Apr 13, 2026
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.

1 participant