mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 05:11:14 -05:00
Fix submission flow issues
This commit is contained in:
@@ -223,10 +223,23 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
submissionContent.park.property_owner_id = null;
|
||||
}
|
||||
|
||||
const finalOperatorId = tempNewOperator ? undefined : (selectedOperatorId || undefined);
|
||||
const finalPropertyOwnerId = operatorIsOwner
|
||||
? finalOperatorId
|
||||
: (tempNewPropertyOwner ? undefined : (selectedPropertyOwnerId || undefined));
|
||||
// Determine final IDs to pass
|
||||
// When creating new entities via composite submission, IDs should be undefined
|
||||
// When using existing entities, pass their IDs directly
|
||||
let finalOperatorId: string | undefined;
|
||||
let finalPropertyOwnerId: string | undefined;
|
||||
|
||||
if (tempNewOperator) {
|
||||
// New operator being created via composite submission
|
||||
finalOperatorId = undefined;
|
||||
finalPropertyOwnerId = operatorIsOwner ? undefined :
|
||||
(tempNewPropertyOwner ? undefined : selectedPropertyOwnerId);
|
||||
} else {
|
||||
// Using existing operator
|
||||
finalOperatorId = selectedOperatorId || undefined;
|
||||
finalPropertyOwnerId = operatorIsOwner ? finalOperatorId :
|
||||
(tempNewPropertyOwner ? undefined : selectedPropertyOwnerId);
|
||||
}
|
||||
|
||||
await onSubmit({
|
||||
...data,
|
||||
|
||||
Reference in New Issue
Block a user