From 580cbab12b9bd25cf2bad48b4c7652fd4a62b4d9 Mon Sep 17 00:00:00 2001 From: Caleb Date: Thu, 31 Oct 2024 16:25:09 -0600 Subject: [PATCH] truncate household members list to the length of the household size --- src/Components/Steps/HouseholdSize.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Components/Steps/HouseholdSize.tsx b/src/Components/Steps/HouseholdSize.tsx index 8b8e72a3..45ced8c2 100644 --- a/src/Components/Steps/HouseholdSize.tsx +++ b/src/Components/Steps/HouseholdSize.tsx @@ -46,9 +46,13 @@ const HouseholdSize = () => { }, }); - const formSubmitHandler: SubmitHandler> = async (householdSizeData) => { + const formSubmitHandler: SubmitHandler> = async ({ householdSize }) => { if (uuid) { - const updatedFormData = { ...formData, ...householdSizeData }; + const updatedFormData = { + ...formData, + householdSize, + householdData: formData.householdData.slice(0, householdSize), + }; setFormData(updatedFormData); await updateScreen(uuid, updatedFormData, locale); nextStep();