From 54a1429989c86cf8dc47423afb37cf6a0d56b554 Mon Sep 17 00:00:00 2001 From: Morgan Ludtke <42942267+ludtkemorgan@users.noreply.github.com> Date: Wed, 21 Aug 2024 13:12:22 -0500 Subject: [PATCH] fix: fetch ami chart with the proper id (#4259) --- .../src/components/listings/PaperListingForm/UnitForm.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sites/partners/src/components/listings/PaperListingForm/UnitForm.tsx b/sites/partners/src/components/listings/PaperListingForm/UnitForm.tsx index 8c5747de82..74ee6302da 100644 --- a/sites/partners/src/components/listings/PaperListingForm/UnitForm.tsx +++ b/sites/partners/src/components/listings/PaperListingForm/UnitForm.tsx @@ -519,15 +519,15 @@ const UnitForm = ({ onSubmit, onClose, defaultUnit, nextId, draft }: UnitFormPro errorMessage={t("errors.requiredFieldError")} validation={{ required: true }} inputProps={{ - onChange: () => { + onChange: (value) => { setValue("amiPercentage", undefined) clearErrors("amiPercentage") clearErrors("amiChart.id") ;[...Array(maxAmiHouseholdSize)].forEach((_, index) => { setValue(`maxIncomeHouseholdSize${index + 1}`, undefined) }) - if (amiChartID && !loading && amiChartsOptions) { - void fetchAmiChart() + if (value?.target?.value && !loading && amiChartsOptions) { + void fetchAmiChart(value.target.value) setIsAmiPercentageDirty(true) } },