Skip to content

Commit

Permalink
feat: deep clear message container
Browse files Browse the repository at this point in the history
  • Loading branch information
veith committed Nov 23, 2023
1 parent 3aba4f0 commit 3b0b04c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/furo-data/src/furo-message-container-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,18 @@ export class FuroMessageContainerHandler extends LitElement {
});
}

_clearValueStates() {
if (this.rootNode) {
_clearValueStates(root) {
if (root) {
// set empty state on all fields
this.rootNode.__childNodes.forEach(node => {
this.rootNode[node._name]._setState({
root.__childNodes.forEach(node => {
root[node._name]._setState({
state: 'None',
description: '',
field: '',
});
if(root[node._name].__childNodes.length > 0){
this._clearValueStates(root[node._name])
}
});
}
}
Expand All @@ -274,7 +277,7 @@ export class FuroMessageContainerHandler extends LitElement {
this.mcDO = fieldNode;

this.mcDO.addEventListener('new-data-injected', () => {
this._clearValueStates();
this._clearValueStates(this.rootNode);
this._applyValueState();
this._updateCountersAndFireEvents();
});
Expand Down

0 comments on commit 3b0b04c

Please sign in to comment.