diff --git a/client/packages/lowcoder/src/comps/generators/withSelectedMultiContext.tsx b/client/packages/lowcoder/src/comps/generators/withSelectedMultiContext.tsx index d34f0ad76..326db5b57 100644 --- a/client/packages/lowcoder/src/comps/generators/withSelectedMultiContext.tsx +++ b/client/packages/lowcoder/src/comps/generators/withSelectedMultiContext.tsx @@ -73,17 +73,6 @@ export function withSelectedMultiContext( comp.getOriginalComp().setParams(comp.cacheParamsMap.get(selection)!) ); } - } else if (( - !action.editDSL - && !isCustomAction(action, "LazyCompReady") - && !isCustomAction(action, "RemoteCompReady") - && !isCustomAction(action, "moduleReady") - ) || action.path[0] !== MAP_KEY || _.isNil(action.path[1]) - ) { - if (action.path[0] === MAP_KEY && action.path[1] === SELECTED_KEY) { - action.path[1] = this.selection; - } - comp = super.reduce(action); } else if (( action.editDSL || isCustomAction(action, "LazyCompReady") @@ -91,17 +80,36 @@ export function withSelectedMultiContext( || isCustomAction(action, "moduleReady") ) && ( action.path[1] === SELECTED_KEY - || ( // special check added for modules inside list view + || ( isCustomAction(action, "moduleReady") && action.path[1] === this.selection) )) { - // broadcast + // broadcast edits from the selected design-time view to all instances and template + const newAction = { + ...action, + path: action.path.slice(2), + }; + comp = comp.reduce(WithMultiContextComp.forEachAction(newAction)); + comp = comp.reduce(wrapChildAction(COMP_KEY, newAction)); + } else if ( + // ensure edits made in the expanded view configurator (SELECTED key) + // also update the template + action.path[0] === MAP_KEY && action.path[1] === SELECTED_KEY + ) { const newAction = { ...action, path: action.path.slice(2), }; comp = comp.reduce(WithMultiContextComp.forEachAction(newAction)); comp = comp.reduce(wrapChildAction(COMP_KEY, newAction)); + } else if (( + !action.editDSL + && !isCustomAction(action, "LazyCompReady") + && !isCustomAction(action, "RemoteCompReady") + && !isCustomAction(action, "moduleReady") + ) || action.path[0] !== MAP_KEY || _.isNil(action.path[1]) + ) { + comp = super.reduce(action); } else if ( !action.editDSL && ( @@ -112,8 +120,6 @@ export function withSelectedMultiContext( ) { comp = super.reduce(action); } - - // console.info("exit withSelectedMultiContext reduce. action: ", action, "\nthis:", this, "\ncomp:", comp); return comp; }