@gisce/react-ooui 1.2.0-rc.8 → 1.2.0-rc.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -43,15 +43,20 @@ type ActionModalOpts = {
|
|
|
43
43
|
actionData?: any;
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
export const ContentRootContext =
|
|
47
|
-
null
|
|
48
|
-
);
|
|
46
|
+
export const ContentRootContext =
|
|
47
|
+
React.createContext<ContentRootContextType | null>(null);
|
|
49
48
|
|
|
50
49
|
type ContentRootProviderProps = {
|
|
51
50
|
children: React.ReactNode;
|
|
52
51
|
globalValues?: any;
|
|
53
52
|
};
|
|
54
53
|
|
|
54
|
+
const callRefreshValues = async (fns: any[]) => {
|
|
55
|
+
for (let i = 0; i < fns.length; i++) {
|
|
56
|
+
await fns?.[i]?.();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
55
60
|
const ContentRootProvider = (
|
|
56
61
|
props: ContentRootProviderProps,
|
|
57
62
|
ref: any
|
|
@@ -64,7 +69,7 @@ const ContentRootProvider = (
|
|
|
64
69
|
TabManagerContext
|
|
65
70
|
) as TabManagerContextType;
|
|
66
71
|
const { openAction } = tabManagerContext || {};
|
|
67
|
-
const onRefreshParentValues = useRef<any>();
|
|
72
|
+
const onRefreshParentValues = useRef<any>([]);
|
|
68
73
|
const { t } = useContext(LocaleContext) as LocaleContextType;
|
|
69
74
|
|
|
70
75
|
useImperativeHandle(ref, () => ({
|
|
@@ -167,7 +172,7 @@ const ContentRootProvider = (
|
|
|
167
172
|
onRefreshParentValues?: any;
|
|
168
173
|
}) {
|
|
169
174
|
const { type } = actionData;
|
|
170
|
-
onRefreshParentValues.current
|
|
175
|
+
onRefreshParentValues.current.push(onRefreshParentValuesFn);
|
|
171
176
|
|
|
172
177
|
if (type === "ir.actions.report.xml") {
|
|
173
178
|
return await generateReport({
|
|
@@ -347,7 +352,8 @@ const ContentRootProvider = (
|
|
|
347
352
|
}
|
|
348
353
|
|
|
349
354
|
async function onFormModalSucceed() {
|
|
350
|
-
onRefreshParentValues.current
|
|
355
|
+
callRefreshValues(onRefreshParentValues.current);
|
|
356
|
+
onRefreshParentValues.current = [];
|
|
351
357
|
setActionModalVisible(false);
|
|
352
358
|
setActionModalOptions({
|
|
353
359
|
domain: undefined,
|
|
@@ -386,7 +392,8 @@ const ContentRootProvider = (
|
|
|
386
392
|
visible={actionModalVisible}
|
|
387
393
|
onSubmitSucceed={onFormModalSucceed}
|
|
388
394
|
onCancel={() => {
|
|
389
|
-
onRefreshParentValues.current
|
|
395
|
+
callRefreshValues(onRefreshParentValues.current);
|
|
396
|
+
onRefreshParentValues.current = [];
|
|
390
397
|
setActionModalVisible(false);
|
|
391
398
|
setActionModalOptions({
|
|
392
399
|
domain: undefined,
|