fix: UX Bug on maintenance page
All checks were successful
Deploy to Staging / Build Images (push) Successful in 1m18s
Deploy to Staging / Deploy to Staging (push) Successful in 44s
Deploy to Staging / Verify Staging (push) Successful in 4s
Deploy to Staging / Notify Staging Ready (push) Successful in 4s
Deploy to Staging / Notify Staging Failure (push) Has been skipped

This commit is contained in:
Eric Gullickson
2026-03-23 19:44:01 -05:00
parent 068bb751a7
commit 8955baae26
2 changed files with 8 additions and 4 deletions

View File

@@ -111,7 +111,7 @@ export const MaintenanceRecordForm: React.FC<MaintenanceRecordFormProps> = ({ ve
mode: 'onChange', mode: 'onChange',
defaultValues: { defaultValues: {
vehicle_id: vehicleId || '', vehicle_id: vehicleId || '',
category: undefined as any, category: '' as any,
subtypes: [], subtypes: [],
date: new Date().toISOString().split('T')[0], date: new Date().toISOString().split('T')[0],
odometer_reading: '' as any, odometer_reading: '' as any,
@@ -132,6 +132,8 @@ export const MaintenanceRecordForm: React.FC<MaintenanceRecordFormProps> = ({ ve
if (watchedCategory) { if (watchedCategory) {
setSelectedCategory(watchedCategory as MaintenanceCategory); setSelectedCategory(watchedCategory as MaintenanceCategory);
setValue('subtypes', []); setValue('subtypes', []);
} else {
setSelectedCategory(null);
} }
}, [watchedCategory, setValue]); }, [watchedCategory, setValue]);
@@ -217,7 +219,7 @@ export const MaintenanceRecordForm: React.FC<MaintenanceRecordFormProps> = ({ ve
// Reset form // Reset form
reset({ reset({
vehicle_id: '', vehicle_id: '',
category: undefined as any, category: '' as any,
subtypes: [], subtypes: [],
date: new Date().toISOString().split('T')[0], date: new Date().toISOString().split('T')[0],
odometer_reading: '' as any, odometer_reading: '' as any,

View File

@@ -119,7 +119,7 @@ export const MaintenanceScheduleForm: React.FC<MaintenanceScheduleFormProps> = (
mode: 'onChange', mode: 'onChange',
defaultValues: { defaultValues: {
vehicle_id: vehicleId || '', vehicle_id: vehicleId || '',
category: undefined as any, category: '' as any,
subtypes: [], subtypes: [],
schedule_type: 'interval' as ScheduleType, schedule_type: 'interval' as ScheduleType,
interval_months: '' as any, interval_months: '' as any,
@@ -145,6 +145,8 @@ export const MaintenanceScheduleForm: React.FC<MaintenanceScheduleFormProps> = (
if (watchedCategory) { if (watchedCategory) {
setSelectedCategory(watchedCategory as MaintenanceCategory); setSelectedCategory(watchedCategory as MaintenanceCategory);
setValue('subtypes', []); setValue('subtypes', []);
} else {
setSelectedCategory(null);
} }
}, [watchedCategory, setValue]); }, [watchedCategory, setValue]);
@@ -170,7 +172,7 @@ export const MaintenanceScheduleForm: React.FC<MaintenanceScheduleFormProps> = (
// Reset form // Reset form
reset({ reset({
vehicle_id: '', vehicle_id: '',
category: undefined as any, category: '' as any,
subtypes: [], subtypes: [],
schedule_type: 'interval' as ScheduleType, schedule_type: 'interval' as ScheduleType,
interval_months: '' as any, interval_months: '' as any,