diff --git a/packages/esm-ward-app/src/ward-patient-card/ward-patient-card.tsx b/packages/esm-ward-app/src/ward-patient-card/ward-patient-card.tsx index 12f706d11..db5b66348 100644 --- a/packages/esm-ward-app/src/ward-patient-card/ward-patient-card.tsx +++ b/packages/esm-ward-app/src/ward-patient-card/ward-patient-card.tsx @@ -6,6 +6,7 @@ import styles from './ward-patient-card.scss'; import { getPatientName, launchWorkspace } from '@openmrs/esm-framework'; import { type ActiveBedSelection, getWardStore, type WardStoreState } from '../store'; import classNames from 'classnames'; +import { closeWorkspace } from '../../../../../openmrs-esm-core/packages/framework/esm-styleguide'; const WardPatientCard: React.FC = (props) => { const wardStore = getWardStore(); @@ -33,6 +34,7 @@ const WardPatientCard: React.FC = (props) => { activeBedSelection?.bed.uuid === props.bed.uuid && activeBedSelection?.patient.uuid === props.patient.uuid, })} onClick={() => { + closeWorkspace('ward-patient-workspace'); wardStore.setState({ activeBedSelection: { ...props } }); launchWorkspace('ward-patient-workspace'); }}> diff --git a/packages/esm-ward-app/src/ward-workspace/ward-patient-notes/notes.workspace.tsx b/packages/esm-ward-app/src/ward-workspace/ward-patient-notes/notes.workspace.tsx index 542c1eec8..0c83ce93e 100644 --- a/packages/esm-ward-app/src/ward-workspace/ward-patient-notes/notes.workspace.tsx +++ b/packages/esm-ward-app/src/ward-workspace/ward-patient-notes/notes.workspace.tsx @@ -13,9 +13,10 @@ const WardPatientNotesWorkspace = ({ const wardStore = getWardStore(); const { patient, visit, bed } = wardStore.getState().activeBedSelection; - setOnCloseCallback(() => { + const handleResetActiveBedSelection = () => { wardStore.setState({ activeBedSelection: null }); - }); + }; + setOnCloseCallback(handleResetActiveBedSelection); const notesFormExtensionState = useMemo( () => ({ @@ -24,6 +25,7 @@ const WardPatientNotesWorkspace = ({ promptBeforeClosing, closeWorkspace, closeWorkspaceWithSavedChanges, + onWorkspaceClose: handleResetActiveBedSelection, }), [patient, closeWorkspace, closeWorkspaceWithSavedChanges, promptBeforeClosing], );