Skip to content

Commit

Permalink
fixes incorrect null checks for referred to facility in discharge modal
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Apr 21, 2024
1 parent 768a5b3 commit 86259bf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Components/Facility/DischargeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ const DischargeModal = ({
}
};

const handleFacilitySelect = (selected: FacilityModel) => {
const handleFacilitySelect = (selected?: FacilityModel) => {
setFacility(selected);
setPreDischargeForm((prev) => ({
...prev,
referred_to: selected.id ?? null,
referred_to_external: !selected.id ? selected.name : null,
referred_to: selected?.id ?? null,
referred_to_external: selected?.name || null,
}));
};

Expand Down Expand Up @@ -215,7 +215,7 @@ const DischargeModal = ({
<FacilitySelect
name="referred_to"
setSelected={(selected) =>
handleFacilitySelect(selected as FacilityModel)
handleFacilitySelect(selected as FacilityModel | undefined)
}
selected={facility ?? null}
showAll
Expand Down

0 comments on commit 86259bf

Please sign in to comment.