fix: Vehicle summary screen does not display maintenance records (#239) #240
Reference in New Issue
Block a user
Delete Branch "issue-239-vehicle-summary-maintenance"
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?
Fixes #239
Summary
The Vehicle Records section on
/garage/vehicles/:idwas never callinguseMaintenanceRecords, so maintenance rows always rendered empty even when records existed for the vehicle. The fuel-log and document data sources were wired in; maintenance was not.Changes
frontend/src/features/vehicles/pages/VehicleDetailPage.tsx(desktop): import and calluseMaintenanceRecords(id), merge maintenance records into the unified records list (category + subtypes + shop name in summary, cost as amount), includeisMaintenanceLoadingin the loading and empty-state guards, and update the row cursor so only fuel-log rows render as clickable.frontend/src/features/vehicles/mobile/VehicleDetailMobile.tsx(mobile): same hook wiring, mobile-format secondary line, and merged loading guard.No backend changes — the endpoint
GET /maintenance/records/vehicle/:vehicleIdand theuseMaintenanceRecordshook already existed and are used byMaintenancePage.Out of scope
VehicleDetailMobilealso does not fetch documents (the filter dropdown offers "Documents" but nouseDocumentsByVehiclehook is wired in). That is a separate gap and not part of this bug. Recommend a follow-up issue.Test plan
npm run type-check(frontend) — passes, no errors.npm run lint(frontend) — 0 errors; 227 baseline warnings unchanged frommain.npm test(frontend) — 17 failed / 196 passed: identical counts tomain, all pre-existing failures in unrelated suites (admin, etc.).https://staging.motovaultpro.com/garage/vehicles/01caf9e8-2b9a-4f24-959f-67a3e6bd91b1and confirm maintenance records render in the Vehicle Records section, filter chips work, totals consistent with/garage/maintenancefiltered by vehicle.Acceptance criteria (from issue)
/garage/maintenancefiltered by vehicle.main.