Browse Source

Exclude "components" property from being dynamic

collection-component
mohamedsalem401 2 years ago
parent
commit
fedde43a3b
  1. 15
      packages/core/src/dom_components/model/ComponentDynamicValueWatcher.ts

15
packages/core/src/dom_components/model/ComponentDynamicValueWatcher.ts

@ -50,14 +50,23 @@ export class ComponentDynamicValueWatcher extends Model<Component> {
} }
addProps(props: ObjectAny, options: DynamicWatchersOptions = {}) { addProps(props: ObjectAny, options: DynamicWatchersOptions = {}) {
const evaluatedProps = this.propertyWatcher.addDynamicValues(props, options); const excludedFromEvaluation = ['components'];
const evaluatedProps = Object.fromEntries(
Object.entries(props).map(([key, value]) =>
excludedFromEvaluation.includes(key)
? [key, value] // Return excluded keys as they are
: [key, this.propertyWatcher.addDynamicValues({ [key]: value }, options)[key]]
)
);
if (props.attributes) { if (props.attributes) {
const evaluatedAttributes = this.attributeWatcher.setDynamicValues(props.attributes, options); const evaluatedAttributes = this.attributeWatcher.setDynamicValues(props.attributes, options);
evaluatedProps['attributes'] = evaluatedAttributes; evaluatedProps['attributes'] = evaluatedAttributes;
} }
const skipOverridUpdates = options.skipWatcherUpdates || options.fromDataSource; const skipOverrideUpdates = options.skipWatcherUpdates || options.fromDataSource;
if (!skipOverridUpdates) { if (!skipOverrideUpdates) {
this.updateSymbolOverride(); this.updateSymbolOverride();
} }

Loading…
Cancel
Save