Skip to content

Commit

Permalink
Fix nested symbols not working on collection component
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamedsalem401 committed Jan 21, 2025
1 parent 979d035 commit e9b46e7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
1 change: 1 addition & 0 deletions packages/core/src/dom_components/model/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1588,6 +1588,7 @@ export default class Component extends StyleableModel<ComponentProperties> {
let obj = Model.prototype.toJSON.call(this, opts);
obj = { ...obj, ...this.componentDVListener.getDynamicPropsDefs() };
obj.attributes = this.componentDVListener.getAttributesDefsOrValues(this.getAttributes());
delete obj.componentDVListener;
delete obj.attributes.class;
delete obj.toolbar;
delete obj.traits;
Expand Down
10 changes: 1 addition & 9 deletions packages/core/src/dom_components/model/SymbolUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,20 +208,12 @@ export const updateSymbolComps = (symbol: Component, m: Component, c: Components
changed: 'components:reset',
});
const cmps = coll.models;
const newSymbols = new Set<Component>();
logSymbol(symbol, 'reset', toUp, { components: cmps });

toUp.forEach((rel) => {
const relCmps = rel.components();
const toReset = cmps.map((cmp, i) => {
// This particular case here is to handle reset from `resetFromString`
// where we can receive an array of regulat components or already
// existing symbols (updated already before reset)
if (!isSymbol(cmp) || newSymbols.has(cmp)) {
newSymbols.add(cmp);
return cmp.clone({ symbol: true });
}
return relCmps.at(i);
return cmp.clone({ symbol: isSymbol(cmp) });
});
relCmps.reset(toReset, { fromInstance: symbol, ...c } as any);
});
Expand Down

0 comments on commit e9b46e7

Please sign in to comment.