Context
When a signed-in user opens Exam History and the exam_attempts fetch fails (a transient network or RLS error), loadHistory logs the error, leaves attempts as [], and clears loading. The render then shows the empty-state message "No exam attempts yet. Take your first practice exam!", so a returning user who actually has history is told they have none. The page cannot tell "no history" apart from "failed to load".
Scope
- File:
src/pages/_History.tsx.
loadHistory (around line 216): the catch (around line 233) currently only calls logError. Add an error state set there.
- Render (around line 542): when the new
error state is set, show a distinct "Could not load your history. Retry." card with a retry button instead of the empty state. The empty state should only render after a successful load with genuinely zero attempts.
- Keep it minimal and in-file. Do not change the query, scoring, or any Supabase call shape.
Acceptance criteria
Context
When a signed-in user opens Exam History and the
exam_attemptsfetch fails (a transient network or RLS error),loadHistorylogs the error, leavesattemptsas[], and clears loading. The render then shows the empty-state message "No exam attempts yet. Take your first practice exam!", so a returning user who actually has history is told they have none. The page cannot tell "no history" apart from "failed to load".Scope
src/pages/_History.tsx.loadHistory(around line 216): thecatch(around line 233) currently only callslogError. Add anerrorstate set there.errorstate is set, show a distinct "Could not load your history. Retry." card with a retry button instead of the empty state. The empty state should only render after a successful load with genuinely zero attempts.Acceptance criteria
loadHistory.npm run lintandnpm run testpass; no new dependencies.