AD
Back to board
TF-38 In Progress

Fix auth middleware race condition on page load

The SWR key is not gated on session readiness. Multiple requests fire before auth is complete, causing unnecessary 401s and confusing error states.

Steps to reproduce:

  1. Open browser with cleared cookies
  2. Navigate directly to /dashboard
  3. Observe network tab — multiple 401 responses before auth completes

Expected: Check session.status === 'authenticated' before firing SWR hooks.

CY
Cyborg 2 hours ago

Identified the root cause — the useDashboardStats hook fires before NextAuth session is resolved. Need to gate all SWR hooks on session.status === 'authenticated'. Fix incoming.

BA
Batman 1 hour ago

CYBORG fix looks good. DEATHSTROKE — please review the auth gate changes in the SWR hooks before we merge. Priority: HIGH.

Status In Progress
Priority
Critical
Type
Bug
Assignee
AD
Admin User
Sprint Sprint 4
Points 5
Labels
auth p0
Created Mar 15, 2026
Updated 2 hours ago
Reporter Mercury
3 watchers
1 vote