Skip to content

Commit f6b6bd8

Browse files
raheeliftikhar5FalkWolsky
authored and
FalkWolsky
committed
fix crashing on reordering comps inside module
1 parent ffa595a commit f6b6bd8

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

client/packages/lowcoder/src/pages/editor/LeftLayersContent.tsx

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
import { DownOutlined } from "@ant-design/icons";
3434
import { ItemType } from "antd/es/menu/hooks/useItems";
3535
import ColorPicker, { configChangeParams } from "components/ColorPicker";
36+
import { ModuleLayoutComp } from "@lowcoder-ee/comps/comps/moduleContainerComp/moduleLayoutComp";
3637

3738

3839
export type DisabledCollisionStatus = "true" | "false"; // "true" means collision is not enabled - Layering works, "false" means collision is enabled - Layering does not work
@@ -209,17 +210,31 @@ export const LeftLayersContent = (props: LeftLayersContentProps) => {
209210

210211
const dsl = editorState.rootComp.toJsonValue();
211212
let layout: any = {};
212-
parentNode.children.forEach((data, index) => {
213-
layout[data.key] = {
214-
...dsl.ui.layout[data.key],
215-
pos: index,
216-
};
217-
})
218-
219-
editorState.rootComp.children.ui.dispatchChangeValueAction({
220-
...dsl.ui,
221-
layout,
222-
})
213+
if(dsl.ui.compType === 'module') {
214+
parentNode.children.forEach((data, index) => {
215+
layout[data.key] = {
216+
...dsl.ui.comp.container.layout[data.key],
217+
pos: index,
218+
};
219+
})
220+
const moduleLayoutComp = editorState.rootComp.children.ui.getModuleLayoutComp();
221+
moduleLayoutComp?.children.container.dispatchChangeValueAction({
222+
...dsl.ui.comp.container,
223+
layout,
224+
})
225+
} else {
226+
parentNode.children.forEach((data, index) => {
227+
layout[data.key] = {
228+
...dsl.ui.layout[data.key],
229+
pos: index,
230+
};
231+
})
232+
233+
editorState.rootComp.children.ui.dispatchChangeValueAction({
234+
...dsl.ui,
235+
layout,
236+
})
237+
}
223238
return newTreeData;
224239
});
225240
}

0 commit comments

Comments
 (0)