Fix simulate route crash and surface actual simulation errors #64
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/simulate-route-error-handling"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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:
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
🤖 Generated with Claude Code