Skip to content

Commit 511d57c

Browse files
fixed context issue in module when used inside list/grid
1 parent e551a05 commit 511d57c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

client/packages/lowcoder/src/comps/comps/moduleComp/moduleComp.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,11 @@ class ModuleTmpComp extends ModuleCompBase {
221221

222222
override changeDispatch(dispatch: DispatchType) {
223223
const next = super.changeDispatch(dispatch);
224-
const nextModuleRootComp = this.moduleRootComp?.changeDispatch(next.getModuleDispatchFn());
224+
const nextModuleRootComp = this.moduleRootComp?.changeDispatch(
225+
this.getModuleDispatchFn(next.dispatch)
226+
);
225227
if (!nextModuleRootComp) {
226-
return next;
228+
return this;
227229
}
228230
return setFieldsNoTypeCheck(
229231
next,
@@ -234,10 +236,10 @@ class ModuleTmpComp extends ModuleCompBase {
234236
);
235237
}
236238

237-
getModuleDispatchFn() {
239+
getModuleDispatchFn(dispatch: DispatchType) {
238240
return (action: CompAction<any>) => {
239241
// log.info("dispatch from module:", action);
240-
this.dispatch(
242+
dispatch(
241243
customAction(
242244
{
243245
type: "delegated",
@@ -305,7 +307,7 @@ class ModuleTmpComp extends ModuleCompBase {
305307
if (getReduceContext().disableUpdateState) return this;
306308
const { dsl, moduleDsl } = action.value;
307309
const moduleRootComp = new RootComp({
308-
dispatch: this.getModuleDispatchFn(),
310+
dispatch: this.getModuleDispatchFn(this.dispatch),
309311
value: dsl,
310312
});
311313
moduleRootComp.setModuleRoot(true);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy