From 8851f94a07b40759d8367127983c9ac4d73fcda9 Mon Sep 17 00:00:00 2001 From: Faran Javed Date: Wed, 1 Oct 2025 16:31:54 +0500 Subject: [PATCH] [Fix]: #2020 dynamic layers issue --- client/packages/lowcoder/src/comps/comps/rootComp.tsx | 4 ++-- client/packages/lowcoder/src/comps/editorState.tsx | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/packages/lowcoder/src/comps/comps/rootComp.tsx b/client/packages/lowcoder/src/comps/comps/rootComp.tsx index 50fe1229ed..7f0f69f761 100644 --- a/client/packages/lowcoder/src/comps/comps/rootComp.tsx +++ b/client/packages/lowcoder/src/comps/comps/rootComp.tsx @@ -100,7 +100,7 @@ const RootView = React.memo((props: RootViewProps) => { return (oldState ? changeEditorStateFn(oldState) : undefined) }); } - }); + }, undefined, isModuleRoot); editorStateRef.current = newEditorState; setEditorState(newEditorState); @@ -109,7 +109,7 @@ const RootView = React.memo((props: RootViewProps) => { editorStateRef.current = undefined; } }; - }, []); + }, [isModuleRoot]); useEffect(() => { if (!mountedRef.current || !editorState) return; diff --git a/client/packages/lowcoder/src/comps/editorState.tsx b/client/packages/lowcoder/src/comps/editorState.tsx index ff928f6f6e..243eefb7de 100644 --- a/client/packages/lowcoder/src/comps/editorState.tsx +++ b/client/packages/lowcoder/src/comps/editorState.tsx @@ -70,13 +70,17 @@ export class EditorState { rootComp: RootComp, setEditorState: (fn: (editorState: EditorState) => EditorState) => void, initialEditorModeStatus: string = getEditorModeStatus(), + isModuleRoot: boolean = false, ) { this.rootComp = rootComp; this.setEditorState = setEditorState; this.editorModeStatus = initialEditorModeStatus; // save collision status from app dsl to localstorage - saveCollisionStatus(this.getCollisionStatus()); + // but only for apps, not for modules (to prevent modules from overwriting the app's setting) + if (!isModuleRoot) { + saveCollisionStatus(this.getCollisionStatus()); + } } /**