Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) O3-2426: Closing drug search panel should send user back to order basket if they previously had it open #1452

Closed
wants to merge 7 commits into from
Prev Previous commit
Next Next commit
PR review follow-ups
  • Loading branch information
ibacher committed Nov 21, 2023
commit de1baf462a642e02e3d49b62af9ba20a56a6f237
8 changes: 4 additions & 4 deletions packages/esm-patient-common-lib/src/workspaces/workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ export function closeWorkspace(name: string, ignoreChanges: boolean, onCloseWork
const store = getWorkspaceStore();
const promptCheckFcn = getPromptBeforeClosingFcn(name);
const updateStoreWithClosedWorkspace = () => {
if (onCloseWorkspace && typeof onCloseWorkspace === 'function') {
onCloseWorkspace?.();
}

const state = store.getState();
const newOpenWorkspaces = state.openWorkspaces.filter((w) => w.name !== name);

Expand All @@ -257,10 +261,6 @@ export function closeWorkspace(name: string, ignoreChanges: boolean, onCloseWork
prompt: null,
openWorkspaces: newOpenWorkspaces,
});

if (onCloseWorkspace && typeof onCloseWorkspace === 'function') {
onCloseWorkspace?.();
}
};
if (!ignoreChanges && promptCheckFcn && promptCheckFcn()) {
const prompt: Prompt = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import classNames from 'classnames';
import { Button, Tile } from '@carbon/react';
import { Add, ChevronDown, ChevronUp } from '@carbon/react/icons';
import { useLayoutType } from '@openmrs/esm-framework';
import { closeWorkspace, launchPatientWorkspace, useOrderBasket } from '@openmrs/esm-patient-common-lib';
import { launchPatientWorkspace, useOrderBasket } from '@openmrs/esm-patient-common-lib';
import { prepMedicationOrderPostData } from '../api/api';
import type { DrugOrderBasketItem } from '../types';
import OrderBasketItemTile from './order-basket-item-tile.component';
Expand Down
Loading