From bfd5924a32ab58c76146cb814794413adf430dc4 Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Fri, 4 Oct 2024 11:33:25 +0530 Subject: [PATCH] Send only known BP attributes --- src/Components/Common/BloodPressureFormField.tsx | 5 ++++- src/Components/LogUpdate/Sections/Vitals.tsx | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Components/Common/BloodPressureFormField.tsx b/src/Components/Common/BloodPressureFormField.tsx index 205bc9a4905..e6fff756d0f 100644 --- a/src/Components/Common/BloodPressureFormField.tsx +++ b/src/Components/Common/BloodPressureFormField.tsx @@ -17,7 +17,10 @@ export default function BloodPressureFormField(props: Props) { const map = meanArterialPressure(props.value)?.toFixed(); const handleChange = (event: FieldChangeEvent) => { - const bp = field.value ?? {}; + const bp = { + systolic: field.value?.systolic, + diastolic: field.value?.diastolic, + }; bp[event.name as keyof BloodPressure] = event.value; field.handleChange(Object.values(bp).filter(Boolean).length ? bp : null); }; diff --git a/src/Components/LogUpdate/Sections/Vitals.tsx b/src/Components/LogUpdate/Sections/Vitals.tsx index 2d533d529e4..9253d2e8697 100644 --- a/src/Components/LogUpdate/Sections/Vitals.tsx +++ b/src/Components/LogUpdate/Sections/Vitals.tsx @@ -137,7 +137,7 @@ const BPAttributeEditor = ({ name={attribute} label={t(attribute)} onChange={(event) => { - const bp = log.bp ?? {}; + const bp = { systolic: log.bp?.systolic, diastolic: log.bp?.diastolic }; bp[event.name as keyof BloodPressure] = event.value; onChange({ bp: Object.values(bp).filter(Boolean).length ? bp : undefined,