diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/editors/node/editor-node.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/editors/node/editor-node.element.ts index c926cc427a..bf2ea77928 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/editors/node/editor-node.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/editors/node/editor-node.element.ts @@ -59,7 +59,7 @@ export class UmbEditorNodeElement extends UmbContextProviderMixin(UmbContextCons private _nodeStore?: UmbNodeStore; private _nodeStoreSubscription?: Subscription; - private _nodeContext = new UmbNodeContext(); + private _nodeContext?: UmbNodeContext; private _nodeContextSubscription?: Subscription; private _notificationService?: UmbNotificationService; @@ -77,8 +77,6 @@ export class UmbEditorNodeElement extends UmbContextProviderMixin(UmbContextCons }); this.addEventListener('property-value-change', this._onPropertyValueChange); - - this.provideContext('umbNodeContext', this._nodeContext); } private _onPropertyValueChange = (e: Event) => { @@ -109,7 +107,12 @@ export class UmbEditorNodeElement extends UmbContextProviderMixin(UmbContextCons this._nodeContextSubscription?.unsubscribe(); - this._nodeContext?.update(node); + if (!this._nodeContext) { + this._nodeContext = new UmbNodeContext(node); + this.provideContext('umbNodeContext', this._nodeContext); + } else { + this._nodeContext.update(node); + } this._nodeContextSubscription = this._nodeContext.data.pipe(distinctUntilChanged()).subscribe((data) => { this._node = data; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/editors/node/node.context.ts b/src/Umbraco.Web.UI.Client/src/backoffice/editors/node/node.context.ts index 530c212831..27045af036 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/editors/node/node.context.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/editors/node/node.context.ts @@ -26,7 +26,7 @@ export class UmbNodeContext { }); public readonly data: Observable = this._data.asObservable(); - constructor(node?: NodeEntity) { + constructor(node: NodeEntity) { if (!node) return; this._data.next(node); }