Skip to content

Commit

Permalink
Merge pull request #7676 from coronasafe/issues/7674/fix-crash-discha…
Browse files Browse the repository at this point in the history
…rge-referred-clear

Fixes app crash upon clearing referred to facility field in discharge dialog
  • Loading branch information
khavinshankar authored Apr 21, 2024
2 parents 768a5b3 + e8fefad commit 1b565fe
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?.id ? 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 1b565fe

Please sign in to comment.