brackt/app
chrisp ad910d4f40
All checks were successful
🚀 Deploy / 🧪 Test (push) Successful in 2m20s
🚀 Deploy / ʦ🔍 Typecheck & Lint (push) Successful in 1m16s
🚀 Deploy / 🐳 Build (push) Successful in 1m8s
🚀 Deploy / 🚀 Deploy (push) Successful in 11s
Fix simulate route crash and surface actual simulation errors (#64)
## Problem

Running a simulation on MLB (and any sport where the readiness check fails) showed a confusing React Router 400 error instead of the real failure reason. The cause: the simulate route had only an \`action\` export. When the action **threw** instead of redirecting, React Router tried to render the route via GET to display the error — hit the missing loader — and replaced the real error with its own internal 400.

A secondary issue: the interim fix used \`?simulationError=\` query params, which had three problems identified in code review:
- Stale errors re-appeared when pressing browser Back after fixing the issue
- The param reflected arbitrary text into the UI (social engineering surface)
- The styling didn't match the established \`bg-destructive/15\` error pattern

## Changes

**\`admin.sports-seasons.\$id.simulate.tsx\`** — strip the action; keep a loader-only redirect stub so bookmarked URLs degrade gracefully to the season page.

**\`admin.sports-seasons.\$id.tsx\`** — add \`intent="simulate"\` to the action dispatcher (matching \`delete\`, \`rescore\`, \`sync-standings\`, \`finalize-standings\`). On success: redirect to expected-values (unchanged). On failure: return \`{ simulateError: message }\` displayed inline with the correct \`bg-destructive/15\` styling.

## Test plan

- [ ] Click Run Simulation on a season with a missing readiness input → error message appears inline below the description text, styled consistently with other errors on the page
- [ ] Click Run Simulation on a fully-configured season → redirects to expected-values as before
- [ ] Navigate directly to \`/admin/sports-seasons/<id>/simulate\` in browser → redirects to season page (no 400)
- [ ] Run simulation, see error, fix the issue, run again successfully → no stale error message persists

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Chris Parsons <chrisparsons1127@gmail.com>
Reviewed-on: #64
2026-06-01 06:47:30 +00:00
..
components Fix World Cup group stage display and upcoming events (#55) 2026-05-27 05:43:08 +00:00
contexts
hooks Fix unhandled rejection from session ping when network is unavailable (#56) 2026-05-27 16:14:14 +00:00
lib Fix draft order initialization for teams added mid-season (#449) 2026-05-19 18:22:47 -07:00
models Fix MLB standings 406 error and refactor ESPN adapter shared code (#62) 2026-06-01 03:31:18 +00:00
routes Fix simulate route crash and surface actual simulation errors (#64) 2026-06-01 06:47:30 +00:00
services Fix MLB standings 406 error and refactor ESPN adapter shared code (#62) 2026-06-01 03:31:18 +00:00
test Add auto-start draft at scheduled time (#437) (#438) 2026-05-16 23:37:29 -07:00
types Redesign standings page with sortable table, 7-day change, and chart repositioned (#205) 2026-03-22 11:05:13 -07:00
utils Add public sports overview page (#451) 2026-05-19 23:02:58 -07:00
welcome Redesign to dark-mode-only with navy palette and accent colors (#13) 2026-02-20 19:26:11 -08:00
app.css Add electric flash + fade animation for draft picks, fixes #381 (#407) 2026-05-10 23:17:29 -07:00
entry.client.tsx Filter unnecessary sentry css and js errors. 2026-03-15 10:24:57 -07:00
entry.server.tsx Replace console.* with structured logger, fix no-inferrable-types (closes #98) (#199) 2026-03-21 13:41:39 -07:00
root.tsx fix: resolve all 48 WCAG 2.2 AA accessibility issues (#439) 2026-05-17 20:11:38 -07:00
routes.ts Add public sports overview page (#451) 2026-05-19 23:02:58 -07:00