Skip to content

Commit

Permalink
Send only known BP attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Oct 4, 2024
1 parent cf8f87b commit bfd5924
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Components/Common/BloodPressureFormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export default function BloodPressureFormField(props: Props) {
const map = meanArterialPressure(props.value)?.toFixed();

const handleChange = (event: FieldChangeEvent<number>) => {
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);
};
Expand Down
2 changes: 1 addition & 1 deletion src/Components/LogUpdate/Sections/Vitals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit bfd5924

Please sign in to comment.