Browse Source

fix component properties continue to watch old dynamic variables

pull/6351/head
mohamedsalem401 1 year ago
parent
commit
33980f748b
  1. 1
      packages/core/src/dom_components/model/ComponentDynamicValueListener.ts
  2. 7
      packages/core/src/dom_components/model/DynamicValueWatcher.ts

1
packages/core/src/dom_components/model/ComponentDynamicValueListener.ts

@ -35,6 +35,7 @@ export class ComponentDynamicValueListener {
} }
watchProps(props: ObjectAny) { watchProps(props: ObjectAny) {
this.propertyWatchClass.removeListeners(Object.keys(props));
this.propertyWatchClass.watchDynamicValue(props); this.propertyWatchClass.watchDynamicValue(props);
} }

7
packages/core/src/dom_components/model/DynamicValueWatcher.ts

@ -72,7 +72,12 @@ export class DynamicValueWatcher {
*/ */
removeListeners(keys?: string[]) { removeListeners(keys?: string[]) {
const propsKeys = keys ? keys : Object.keys(this.dynamicVariableListeners); const propsKeys = keys ? keys : Object.keys(this.dynamicVariableListeners);
propsKeys.forEach((key) => this.dynamicVariableListeners[key].destroy()); propsKeys.forEach((key) => {
if (this.dynamicVariableListeners[key]) {
this.dynamicVariableListeners[key].destroy();
delete this.dynamicVariableListeners[key];
}
});
} }
getSerializableValues(values: ObjectAny) { getSerializableValues(values: ObjectAny) {

Loading…
Cancel
Save