fix: display purchase info and fix validation on vehicle detail (#41) #42

Merged
egullickson merged 2 commits from issue-41-fix-purchase-info into main 2026-01-16 03:04:17 +00:00
Owner

Summary

Fixes #41 - Purchase information not displayed and save fails on vehicle detail page

Changes

  • Add purchase price and purchase date display to vehicle detail page under "Current Odometer Reading"
  • Fix form validation to properly handle empty number inputs (NaN → null preprocessing)

Root Cause

  1. Display Issue: Purchase info fields existed in the Vehicle type but were not rendered in VehicleDetailPage.tsx
  2. Validation Issue: When number inputs with valueAsNumber: true are empty, React Hook Form returns NaN. The zod .min(0) check failed on NaN values, causing validation errors.

Files Changed

  • frontend/src/features/vehicles/pages/VehicleDetailPage.tsx - Added purchase info display section
  • frontend/src/features/vehicles/components/VehicleForm.tsx - Added z.preprocess(nanToNull, ...) for number fields

Test Plan

  • View vehicle detail page - purchase info should display
  • Edit vehicle without purchase info - should save without validation error
  • Edit vehicle with purchase info - should save successfully
  • Test on mobile viewport (320px, 768px)
  • Test on desktop viewport (1920px)

🤖 Generated with Claude Code

## Summary Fixes #41 - Purchase information not displayed and save fails on vehicle detail page ### Changes - Add purchase price and purchase date display to vehicle detail page under "Current Odometer Reading" - Fix form validation to properly handle empty number inputs (NaN → null preprocessing) ### Root Cause 1. **Display Issue**: Purchase info fields existed in the Vehicle type but were not rendered in VehicleDetailPage.tsx 2. **Validation Issue**: When number inputs with `valueAsNumber: true` are empty, React Hook Form returns `NaN`. The zod `.min(0)` check failed on NaN values, causing validation errors. ### Files Changed - `frontend/src/features/vehicles/pages/VehicleDetailPage.tsx` - Added purchase info display section - `frontend/src/features/vehicles/components/VehicleForm.tsx` - Added `z.preprocess(nanToNull, ...)` for number fields ## Test Plan - [ ] View vehicle detail page - purchase info should display - [ ] Edit vehicle without purchase info - should save without validation error - [ ] Edit vehicle with purchase info - should save successfully - [ ] Test on mobile viewport (320px, 768px) - [ ] Test on desktop viewport (1920px) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
egullickson added 1 commit 2026-01-16 02:53:43 +00:00
fix: display purchase info and fix validation on vehicle detail (refs #41)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 2m47s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 38s
Deploy to Staging / Verify Staging (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 6s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
a1d3dd965a
- Add purchase price and purchase date display to vehicle detail page
- Fix form validation to handle NaN from empty number inputs using z.preprocess

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
egullickson added 1 commit 2026-01-16 02:56:11 +00:00
fix: add mobile responsive breakpoint to purchase info grid (refs #41)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 2m43s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 29s
Deploy to Staging / Verify Staging (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 6s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
731d67f324
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
egullickson merged commit 2ebae468c6 into main 2026-01-16 03:04:17 +00:00
egullickson deleted branch issue-41-fix-purchase-info 2026-01-16 03:04:18 +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#42