fix: Vehicle summary screen does not display maintenance records (#239) #240

Merged
egullickson merged 2 commits from issue-239-vehicle-summary-maintenance into main 2026-05-16 01:56:11 +00:00
Owner

Fixes #239

Summary

The Vehicle Records section on /garage/vehicles/:id was never calling useMaintenanceRecords, 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 call useMaintenanceRecords(id), merge maintenance records into the unified records list (category + subtypes + shop name in summary, cost as amount), include isMaintenanceLoading in 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/:vehicleId and the useMaintenanceRecords hook already existed and are used by MaintenancePage.

Out of scope

  • Mobile VehicleDetailMobile also does not fetch documents (the filter dropdown offers "Documents" but no useDocumentsByVehicle hook 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 from main.
  • npm test (frontend) — 17 failed / 196 passed: identical counts to main, all pre-existing failures in unrelated suites (admin, etc.).
  • Manual on staging desktop (≥1920px): visit https://staging.motovaultpro.com/garage/vehicles/01caf9e8-2b9a-4f24-959f-67a3e6bd91b1 and confirm maintenance records render in the Vehicle Records section, filter chips work, totals consistent with /garage/maintenance filtered by vehicle.
  • Manual on staging mobile viewports (320px, 768px): same vehicle, confirm maintenance records render under the Vehicle Records section.
  • Manual: vehicle with zero maintenance records still shows the "No records found for this filter." empty state.
  • Manual: no console errors on page load.

Acceptance criteria (from issue)

  • Maintenance records render in the Vehicle Records section on desktop and mobile.
  • Empty state only renders when the vehicle truly has zero records.
  • Records consistent with /garage/maintenance filtered by vehicle.
  • Linting, type-check, and tests at parity with main.
Fixes #239 ## Summary The Vehicle Records section on `/garage/vehicles/:id` was never calling `useMaintenanceRecords`, 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 call `useMaintenanceRecords(id)`, merge maintenance records into the unified records list (category + subtypes + shop name in summary, cost as amount), include `isMaintenanceLoading` in 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/:vehicleId` and the `useMaintenanceRecords` hook already existed and are used by `MaintenancePage`. ## Out of scope - Mobile `VehicleDetailMobile` also does not fetch documents (the filter dropdown offers "Documents" but no `useDocumentsByVehicle` hook is wired in). That is a separate gap and not part of this bug. Recommend a follow-up issue. ## Test plan - [x] `npm run type-check` (frontend) — passes, no errors. - [x] `npm run lint` (frontend) — 0 errors; 227 baseline warnings unchanged from `main`. - [x] `npm test` (frontend) — 17 failed / 196 passed: identical counts to `main`, all pre-existing failures in unrelated suites (admin, etc.). - [ ] Manual on staging desktop (≥1920px): visit `https://staging.motovaultpro.com/garage/vehicles/01caf9e8-2b9a-4f24-959f-67a3e6bd91b1` and confirm maintenance records render in the Vehicle Records section, filter chips work, totals consistent with `/garage/maintenance` filtered by vehicle. - [ ] Manual on staging mobile viewports (320px, 768px): same vehicle, confirm maintenance records render under the Vehicle Records section. - [ ] Manual: vehicle with zero maintenance records still shows the "No records found for this filter." empty state. - [ ] Manual: no console errors on page load. ## Acceptance criteria (from issue) - [x] Maintenance records render in the Vehicle Records section on desktop and mobile. - [x] Empty state only renders when the vehicle truly has zero records. - [x] Records consistent with `/garage/maintenance` filtered by vehicle. - [x] Linting, type-check, and tests at parity with `main`.
egullickson added 1 commit 2026-05-16 01:46:06 +00:00
fix: show maintenance records on vehicle summary screen (refs #239)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 1m14s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 42s
Deploy to Staging / Verify Staging (pull_request) Successful in 3s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 4s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
a49f419eab
The Vehicle Records section on /garage/vehicles/:id never called
useMaintenanceRecords, so maintenance rows always rendered empty even
when records existed for the vehicle. Wire the existing hook into both
the desktop VehicleDetailPage and mobile VehicleDetailMobile, merge
records into the unified list with category + subtypes + shop name,
and include the maintenance loading state in the section's loading
and empty-state guards.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
egullickson added 1 commit 2026-05-16 01:52:00 +00:00
fix: coerce maintenance cost to number for amount column (refs #239)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 1m11s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 42s
Deploy to Staging / Verify Staging (pull_request) Successful in 4s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 3s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
55b8b67a6e
Postgres numeric columns come back as strings via node-postgres, so
typeof rec.cost === 'number' was false and the amount column rendered
as '—'. Coerce with Number() (matching the pattern in
MaintenanceRecordsList) so the cost displays as a dollar amount.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
egullickson merged commit 9f5c81a14e into main 2026-05-16 01:56:11 +00:00
egullickson deleted branch issue-239-vehicle-summary-maintenance 2026-05-16 01:56:11 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: egullickson/motovaultpro#240