mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 01:51:12 -05:00
Fix state machine cleanup
This commit is contained in:
@@ -181,8 +181,6 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
|
||||
const handleFormSubmit = async (data: ParkFormData) => {
|
||||
try {
|
||||
dispatch({ type: 'SUBMIT', payload: { submissionId: crypto.randomUUID() } });
|
||||
|
||||
// Build composite submission if new entities were created
|
||||
const submissionContent: any = {
|
||||
park: data,
|
||||
@@ -207,8 +205,6 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
_compositeSubmission: (tempNewOperator || tempNewPropertyOwner) ? submissionContent : undefined
|
||||
});
|
||||
|
||||
dispatch({ type: 'SUBMISSION_COMPLETE' });
|
||||
|
||||
toast({
|
||||
title: isEditing ? "Park Updated" : "Park Created",
|
||||
description: isEditing
|
||||
@@ -217,11 +213,6 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
const errorMessage = getErrorMessage(error);
|
||||
if (errorMessage.includes('validation') || errorMessage.includes('required')) {
|
||||
dispatch({ type: 'VALIDATION_ERROR', payload: [{ field: 'general', message: errorMessage }] });
|
||||
} else {
|
||||
dispatch({ type: 'RESET' });
|
||||
}
|
||||
handleError(error, {
|
||||
action: isEditing ? 'Update Park' : 'Create Park',
|
||||
userId: user?.id,
|
||||
|
||||
Reference in New Issue
Block a user