Skip to content

fix: show load and action errors with retry instead of empty states - #182

Merged
TheCodeHeist-Coder merged 1 commit into
TheCodeHeist-Coder:mainfrom
lb1192176991-lab:fix/load-error-states-180
Oct 21, 2026
Merged

TheCodeHeist-Coder merged 1 commit into
TheCodeHeist-Coder:mainfrom
lb1192176991-lab:fix/load-error-states-180

Conversation

@lb1192176991-lab

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds real error states to the dashboard and the quiz builder, so a failed request is no longer shown as "you have no data".

What

  • Dashboard.tsx: fetchQuizzes now records a load error; the hosted-quizzes panel shows an error message with a Retry button instead of the empty state, and the play-history panel stays blank instead of claiming "No played history yet." handleCreate records a create error, shown inside the create modal.
  • QuizBuilder.tsx: fetchQuiz records a load error, rendered with a Retry button instead of an empty question list; handleGenerateCode records an error shown next to the Generate button.
  • Tests: 2 new Dashboard tests and 2 new QuizBuilder tests cover failed load (error + retry + recovery) and failed create / generate-code.

Why

Fixes #180. GET /quizzes and GET /quizzes/:id swallow failures, so a network blip or 500 renders the misleading empty-state copy. An organiser about to host a session is told their quizzes do not exist. The same pattern silently eats failed create and generate-code requests.

Kept each screen's states inline (no shared component) so the diff stays reviewable, per the issue's guidance.

Testing

  • npx vitest run src/screens/Dashboard.test.tsx src/screens/QuizBuilder.test.tsx — 11/11 pass.
  • Full frontend suite npx vitest run — 34 passed, 1 failed (JoinQuiz.test.tsx); verified that failure exists on clean main without these changes.
  • npx tsc -b — clean.
  • npx eslint on the touched files — no new warnings; remaining no-explicit-any errors are on untouched lines and pre-exist on main.

Note: this branch is based on main, independent of PR #181 (the duplicate-modal fix). If #181 merges first, I'll rebase.

Related issue

Closes #180

Type of change

  • Bug fix
  • Tests

Which services does this touch?

  • apps/frontend

How did you test this?

Ran the commands above locally on Windows (Node 20, pnpm 10). Simulated failures with mocked API rejections.

Checklist

  • I ran pnpm run lint (ran scoped eslint on the changed files instead — see Testing)
  • I ran pnpm run check-types (equivalent tsc -b in apps/frontend)
  • I ran pnpm run build
  • The app still starts with docker-compose up
  • I updated documentation if this changes behaviour or setup
  • I did not commit any .env file, API key or other secret

First pull request here? Unticked checkboxes reflect what I could not run on this machine (Docker/full build); happy to run anything else you'd like.

@TheCodeHeist-Coder
TheCodeHeist-Coder merged commit 58e81c0 into TheCodeHeist-Coder:main Oct 21, 2026
9 checks passed
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.

A failed load is shown to the user as "you have no quizzes"

2 participants