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
Call onCloseWorkspace at end to allow launching workspace
  • Loading branch information
ibacher committed Nov 21, 2023
commit d59dc6daa13064a8fbe827102e413342242f1bb9
16 changes: 8 additions & 8 deletions packages/esm-patient-common-lib/src/workspaces/workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,6 @@ export function closeWorkspace(name: string, ignoreChanges: boolean, onCloseWork
const store = getWorkspaceStore();
const promptCheckFcn = getPromptBeforeClosingFcn(name);
const updateStoreWithClosedWorkspace = () => {
if (onCloseWorkspace && typeof onCloseWorkspace === 'function') {
try {
onCloseWorkspace();
} catch (e) {
console.error(`Custom 'onCloseWorkspace' for workspace ${name} caused an error`, e);
}
}

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

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

if (onCloseWorkspace && typeof onCloseWorkspace === 'function') {
try {
onCloseWorkspace();
} catch (e) {
console.error(`Custom 'onCloseWorkspace' for workspace ${name} caused an error`, e);
}
}
};
if (!ignoreChanges && promptCheckFcn && promptCheckFcn()) {
const prompt: Prompt = {
Expand Down