Skip to content

Commit

Permalink
Merge branch 'feat/sse-open-actions' into alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
mguellsegarra committed Jan 21, 2025
2 parents 640f748 + 91dc69f commit 964d3a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/context/ContentRootContext.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
FormView,
GenerateReportOptions,
ViewType,
ActionRawData,
} from "@/types";
import { FormView, GenerateReportOptions, ViewType } from "@/types";
import React, {
useContext,
useRef,
Expand Down Expand Up @@ -79,6 +74,7 @@ const ContentRootProvider = (

useImperativeHandle(ref, () => ({
openActionModal,
processAction,
}));

// Action modal state
Expand Down Expand Up @@ -177,7 +173,9 @@ const ContentRootProvider = (
onRefreshParentValues?: any;
}) {
const { type } = actionData;
onRefreshParentValues.current.push(onRefreshParentValuesFn);
if (onRefreshParentValuesFn) {
onRefreshParentValues.current.push(onRefreshParentValuesFn);
}

if (type === "ir.actions.report.xml") {
return await generateReport({
Expand Down Expand Up @@ -222,15 +220,15 @@ const ContentRootProvider = (
)[0];
}

const rawContext = actionData.context;
const rawContext = actionData?.context;
const responseContext =
typeof actionData?.context === "string"
? parseContext({
context: actionData.context,
fields,
values: { ...values, ...globalValues },
})
: actionData.context;
: actionData?.context || {};

const mergedContext = {
...context,
Expand Down Expand Up @@ -296,6 +294,7 @@ const ContentRootProvider = (
fields,
values,
},
res_id: actionData.res_id,
});

return { closeParent: true };
Expand Down
1 change: 1 addition & 0 deletions src/views/RootView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function RootView(props: RootViewProps, ref: any) {
openShortcut,
handleOpenActionUrl,
handleOpenActionResourceUrl,
processAction: (contentRootProvider.current as any).processAction,
}));

function remove(key: string) {
Expand Down

0 comments on commit 964d3a3

Please sign in to comment.