Skip to content

Commit 104abcc

Browse files
authored
feat(framework): implement invalidateParent (#1964)
1 parent 45cdcc2 commit 104abcc

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

docs/dev/Metadata.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Setting | Type | Default | Description
113113
`individualSlots` | `Boolean` | false | If set to `true`, each child will have its own slot, allowing you to arrange/wrap the children arbitrarily.
114114
`propertyName` | `String` | N/A | Allows to set the name of the property on the Web Component, where the children belonging to this slot will be stored.
115115
`listenFor` | `Object` | N/A | **Experimental, do not use.** If set, whenever the children, belonging to this slot have their properties changed, the Web Component will be invalidated.
116-
116+
`invalidateParent` | `Boolean` | false | **Experimental, do not use.** Defines whether every invalidation of a UI5 Web Component in this slot should trigger an invalidation of the parent UI5 Web Component.
117117
The `type` setting is required.
118118

119119
Notes:

packages/base/src/UI5Element.js

+10
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class UI5Element extends HTMLElement {
5858

5959
this._monitoredChildProps = new Map();
6060
this._firePropertyChange = false;
61+
this._shouldInvalidateParent = false;
6162
}
6263

6364
/**
@@ -267,6 +268,10 @@ class UI5Element extends HTMLElement {
267268
this._attachChildPropertyUpdated(child, slotData.listenFor);
268269
}
269270

271+
if (child.isUI5Element && slotData.invalidateParent) {
272+
child._shouldInvalidateParent = true;
273+
}
274+
270275
if (isSlot(child)) {
271276
this._attachSlotChange(child);
272277
}
@@ -305,6 +310,7 @@ class UI5Element extends HTMLElement {
305310
children.forEach(child => {
306311
if (child && child.isUI5Element) {
307312
this._detachChildPropertyUpdated(child);
313+
child._shouldInvalidateParent = false;
308314
}
309315

310316
if (isSlot(child)) {
@@ -496,6 +502,10 @@ class UI5Element extends HTMLElement {
496502
this._upToDate = false;
497503
// console.log("INVAL", this, ...arguments);
498504
RenderScheduler.renderDeferred(this);
505+
506+
if (this._shouldInvalidateParent) {
507+
this.parentNode._invalidate();
508+
}
499509
}
500510
}
501511

0 commit comments

Comments
 (0)