fix: validate per-step fields before advancing Create Server wizard

- Add STEP_FIELDS constant mapping each step to its required fields
- Extract trigger() from useForm and call it on Next click
- Only advance to next step when trigger() returns true, blocking
  silent failures where invalid data could reach the Review step
- Add CreateServerPage.test.tsx with 8 tests covering step navigation,
  validation blocking, happy path, and submit mutation
- Update CLAUDE.md: mark /servers/new Complete, remove resolved bug
- Mark implementation plan as completed
This commit is contained in:
Khoa (Revenovich) Tran Gia
2026-04-17 13:23:21 +07:00
parent 947f4773e7
commit bbfb044b5d
4 changed files with 356 additions and 6 deletions

View File

@@ -37,13 +37,9 @@ All routers, services, repositories, game adapter system, WebSocket, background
| `/login` | Complete | Zod + react-hook-form validation |
| `/` | Complete | Dashboard with server grid |
| `/servers/:id` | Complete | 7-tab detail page (overview, config, players, bans, missions, mods, logs) |
| `/servers/new` | Partial | 4-step wizard; **known bug: form validation issues cause silent failure on submit** |
| `/servers/new` | Complete | 4-step wizard with per-step validation via `trigger()` |
| `/settings` | Complete | Password change + admin user management |
### Known Bugs (as of 2026-04-17)
1. **Create Server silent failure**: The 4-step wizard's "Next" buttons don't validate before advancing steps, so users can reach step 3 with invalid data. `handleSubmit` then silently fails because validation errors prevent `onSubmit` from firing. Fix: validate on each "Next" click using `trigger()` from react-hook-form.
### Frontend Type Mapping (API → Frontend)
| API Resource | Frontend Type | Key Fields |