diff --git a/packages/core/src/dom_components/model/SymbolUtils.ts b/packages/core/src/dom_components/model/SymbolUtils.ts index 8ea1e0589..6f14c2336 100644 --- a/packages/core/src/dom_components/model/SymbolUtils.ts +++ b/packages/core/src/dom_components/model/SymbolUtils.ts @@ -3,6 +3,7 @@ import Component, { keySymbol, keySymbolOvrd, keySymbols } from './Component'; import { SymbolToUpOptions } from './types'; import { isEmptyObj } from '../../utils/mixins'; import Components from './Components'; +import { CollectionVariableType } from '../../data_sources/model/collection_component/constants'; export const isSymbolMain = (cmp: Component) => isArray(cmp.get(keySymbols)); @@ -140,6 +141,15 @@ export const updateSymbolProps = (symbol: Component, opts: SymbolToUpOptions = { }; delete changed.status; delete changed.open; + const toUp = getSymbolsToUpdate(symbol, opts); + if ( + symbol.get('isCollectionItem') && + !(Object.keys(changed).length === 1 && Object.keys(changed)[0] === keySymbolOvrd) + ) { + toUp.forEach((child) => { + child.setSymbolOverride(symbol.getSymbolOverride() || [], { fromDataSource: true }); + }); + } delete changed[keySymbols]; delete changed[keySymbol]; delete changed[keySymbolOvrd]; @@ -154,9 +164,8 @@ export const updateSymbolProps = (symbol: Component, opts: SymbolToUpOptions = { const toUp = getSymbolsToUpdate(symbol, opts); // Avoid propagating overrides to other symbols keys(changed).map((prop) => { - const shouldPropagate = - !isSymbolOverride(symbol, prop) || (symbol.get('isCollectionItem') && !opts.fromDataSource); - if (!shouldPropagate) delete changed[prop]; + const shouldPropagate = isSymbolOverride(symbol, prop) && !(changed[prop].type === CollectionVariableType); + if (shouldPropagate) delete changed[prop]; }); logSymbol(symbol, 'props', toUp, { opts, changed }); @@ -164,9 +173,8 @@ export const updateSymbolProps = (symbol: Component, opts: SymbolToUpOptions = { const propsChanged = { ...changed }; // Avoid updating those with override keys(propsChanged).map((prop) => { - const shouldPropagate = - !isSymbolOverride(child, prop) || (child.get('isCollectionItem') && !opts.fromDataSource); - if (!shouldPropagate) delete propsChanged[prop]; + const shouldPropagate = isSymbolOverride(child, prop) && !(propsChanged[prop].type === CollectionVariableType); + if (shouldPropagate) delete propsChanged[prop]; }); child.set(propsChanged, { fromInstance: symbol, ...opts }); });