Skip to content

Commit

Permalink
OCPBUGS-33011: fix issues with Edit Route form
Browse files Browse the repository at this point in the history
  • Loading branch information
rhamilto committed Apr 25, 2024
1 parent 6c7e5f0 commit d8b862e
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions frontend/public/components/routes/create-route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,22 @@ class CreateRouteWithTranslation extends React.Component<
};

removeAltServiceEntry(alternateServiceIndex: number) {
this.setState(({ alternateServices }) => {
const updatedServiceEntriesArray: AlternateServiceEntryType[] = [...alternateServices];
updatedServiceEntriesArray.splice(alternateServiceIndex, 1);
this.props.formik.setFieldValue('formData.alternateServices', updatedServiceEntriesArray);
if (updatedServiceEntriesArray.length < 1) {
this.setState({ weight: 100 });
this.props.formik.setFieldValue('formData.weight', 100);
}
return {
alternateServices: updatedServiceEntriesArray,
};
});
this.setState(
({ alternateServices }) => {
const updatedServiceEntriesArray: AlternateServiceEntryType[] = [...alternateServices];
updatedServiceEntriesArray.splice(alternateServiceIndex, 1);
this.props.formik.setFieldValue('formData.alternateServices', updatedServiceEntriesArray);
return {
alternateServices: updatedServiceEntriesArray,
};
},
() => {
if (this.state.alternateServices.length < 1) {
this.setState({ weight: 100 });
this.props.formik.setFieldValue('formData.weight', 100);
}
},
);
}

onDataChanged = (updatedEntry: AlternateServiceEntryGroupData, index: number) => {
Expand Down

0 comments on commit d8b862e

Please sign in to comment.