diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block/workspace/block-element-manager.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block/workspace/block-element-manager.ts index afdfb4321b..d0c3ad6c42 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block/workspace/block-element-manager.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block/workspace/block-element-manager.ts @@ -65,9 +65,30 @@ export class UmbBlockElementManager extends UmbControllerBase { } async setPropertyValue(alias: string, value: unknown) { + this.initiatePropertyValueChange(); await this.#getDataPromise; this.#data.update({ [alias]: value }); + this.finishPropertyValueChange(); + } + + #updateLock = 0; + initiatePropertyValueChange() { + this.#updateLock++; + this.#data.mute(); + // TODO: When ready enable this code will enable handling a finish automatically by this implementation 'using myState.initiatePropertyValueChange()' (Relies on TS support of Using) [NL] + /*return { + [Symbol.dispose]: this.finishPropertyValueChange, + };*/ + } + finishPropertyValueChange = () => { + this.#updateLock--; + this.#triggerPropertyValueChanges(); + }; + #triggerPropertyValueChanges() { + if (this.#updateLock === 0) { + this.#data.unmute(); + } } public createPropertyDatasetContext(host: UmbControllerHost) {