From b3b08c3af5161bcb21fc54f679d811915ebbc076 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 22 Jan 2025 15:38:36 +0100 Subject: [PATCH] widget: amend 1bfc558f83deef094b4d1bd2e986f4693c4e55e8 & 857e0408be41fa846fb85e3ea87e134a79979f18 to only affect clones and fix circular loop regression --- src/client/widgets/common/widget.js | 2 +- src/client/widgets/containers/clone.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/client/widgets/common/widget.js b/src/client/widgets/common/widget.js index 1b4e05f4..c6fc02a5 100644 --- a/src/client/widgets/common/widget.js +++ b/src/client/widgets/common/widget.js @@ -978,7 +978,7 @@ class Widget extends EventEmitter { // emit prop-changed event if not already // to make sure an advanced syntax changes don't go unnoticed by clone var unNotified = propNames.filter(n => !changedProps.includes(n)) - widgetManager.trigger('prop-changed', { + widgetManager.trigger('prop-changed-maybe', { id: this.getProp('id'), props: unNotified, widget: this, diff --git a/src/client/widgets/containers/clone.js b/src/client/widgets/containers/clone.js index 7aa87be1..22badfb4 100644 --- a/src/client/widgets/containers/clone.js +++ b/src/client/widgets/containers/clone.js @@ -95,7 +95,7 @@ class Clone extends Container() { }, {context: this}) - widgetManager.on('prop-changed', (e)=>{ + var onPropChanged = (e)=>{ // watch for prop changes initiated by the editor // Other changes (from advanced syntaxes) are already // handled by standard widget mechanicsé @@ -109,7 +109,12 @@ class Clone extends Container() { } - }, {context: this}) + } + + widgetManager.on('prop-changed', onPropChanged, {context: this}) + + // see common/widget.js @ updateProps() + widgetManager.on('prop-changed-maybe', onPropChanged, {context: this}) this.on('widget-created', (e)=>{