mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 09:11:13 -05:00
Fix: Re-evaluate initial submission validation
This commit is contained in:
@@ -271,13 +271,24 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
(tempNewPropertyOwner ? undefined : selectedPropertyOwnerId);
|
||||
}
|
||||
|
||||
await onSubmit({
|
||||
// Debug: Log what's being submitted
|
||||
const submissionData = {
|
||||
...data,
|
||||
operator_id: finalOperatorId,
|
||||
property_owner_id: finalPropertyOwnerId,
|
||||
_compositeSubmission: (tempNewOperator || tempNewPropertyOwner) ? submissionContent : undefined
|
||||
};
|
||||
|
||||
console.info('[ParkForm] Submitting park data:', {
|
||||
hasLocation: !!submissionData.location,
|
||||
hasLocationId: !!submissionData.location_id,
|
||||
locationData: submissionData.location,
|
||||
parkName: submissionData.name,
|
||||
isEditing
|
||||
});
|
||||
|
||||
await onSubmit(submissionData);
|
||||
|
||||
// Parent component handles success feedback
|
||||
} catch (error: unknown) {
|
||||
const errorMessage = getErrorMessage(error);
|
||||
@@ -426,7 +437,9 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
</Label>
|
||||
<LocationSearch
|
||||
onLocationSelect={(location) => {
|
||||
console.info('[ParkForm] Location selected:', location);
|
||||
setValue('location', location);
|
||||
console.info('[ParkForm] Location set in form:', watch('location'));
|
||||
// Manually trigger validation for the location field
|
||||
trigger('location');
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user