Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
Correctly reset initialValues
Browse files Browse the repository at this point in the history
  • Loading branch information
GDamaso committed Aug 14, 2024
2 parents ede6a6e + b85db6c commit 5a53ac2
Showing 1 changed file with 1 addition and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,7 @@ const FieldsAndSoilComponent: FC<InputModuleProps> = ({
removeField(newField);
farmInfo.Fields.push(newField);

// splice or pop to remove Crops after getting pushed to array
// if (farmInfo.Fields[fieldIndex].Crops.length === 1) {
// // Crops is not optional so this line is needed
// farmInfo.Fields[fieldIndex].Crops.splice(0, 1);
// }
// if (farmInfo.Fields[fieldIndex].Nutrients.nutrientFertilizers.length === 1) {
// farmInfo.Fields[fieldIndex].Nutrients.nutrientFertilizers.splice(0, 1);
// }

setInitialValues(initialValues);
setInitialValues(initialFarmDetails.Fields[0]);
setFarmDetails(farmInfo);
setFieldIndex((prevIndex) => prevIndex + 1);
setSubmitted(true);
Expand Down

0 comments on commit 5a53ac2

Please sign in to comment.