diff --git a/client/src/components/bill-form/bill-form.component.jsx b/client/src/components/bill-form/bill-form.component.jsx index 579d11b7b..ba9f937ba 100644 --- a/client/src/components/bill-form/bill-form.component.jsx +++ b/client/src/components/bill-form/bill-form.component.jsx @@ -80,15 +80,17 @@ export function BillFormComponent({ }; const handleFederalTaxExemptSwitchToggle = (checked) => { - if (checked) { - const values = form.getFieldsValue("billlines"); - if (values && values.billlines && values.billlines.length > 0) { - values.billlines.forEach((b) => { - b.applicable_taxes.federal = false; - }); - } - form.setFieldsValue({ billlines: values.billlines }); - } + // Early gate + if (!checked) return; + const values = form.getFieldsValue("billlines"); + // Gate bill lines + if (!values?.billlines?.length) return; + + const billlines = values.billlines.map((b) => { + b.applicable_taxes.federal = false; + return b; + }); + form.setFieldsValue({ billlines }); }; useEffect(() => {