Skip to content

Commit b3e3b3f

Browse files
authored
fix: broken child property observation (#423)
1 parent 115900b commit b3e3b3f

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

packages/base/src/UI5Element.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -359,28 +359,30 @@ class UI5Element extends HTMLElement {
359359
this._monitoredChildProps.set(slotName, { observedProps, notObservedProps });
360360
}
361361

362-
child.addEventListener("_propertyChange", this._onChildPropertyUpdated);
362+
child.addEventListener("_propertyChange", this._invalidateParentOfPropertyUpdate);
363363
}
364364

365365
_detachChildPropertyUpdated(child) {
366-
child.removeEventListener("_propertyChange", this._onChildPropertyUpdated);
366+
child.removeEventListener("_propertyChange", this._invalidateParentOfPropertyUpdate);
367367
}
368368

369-
_onChildPropertyUpdated(prop) {
370-
if (!this.parentNode) {
369+
_invalidateParentOfPropertyUpdate(prop) {
370+
// The web component to be invalidated
371+
const parentNode = this.parentNode;
372+
if (!parentNode) {
371373
return;
372374
}
373375

374-
const slotName = this.constructor._getSlotName(this);
375-
const propsMetadata = this.parentNode._monitoredChildProps.get(slotName);
376+
const slotName = parentNode.constructor._getSlotName(this);
377+
const propsMetadata = parentNode._monitoredChildProps.get(slotName);
376378

377379
if (!propsMetadata) {
378380
return;
379381
}
380382
const { observedProps, notObservedProps } = propsMetadata;
381383

382384
if (observedProps.includes(prop.detail.name) && !notObservedProps.includes(prop.detail.name)) {
383-
this.parentNode._invalidate("_parent_", this);
385+
parentNode._invalidate("_parent_", this);
384386
}
385387
}
386388

0 commit comments

Comments
 (0)