diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/property/workspace-property.context.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/property/workspace-property.context.ts index d1cfea7707..7d9fdac5dd 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/property/workspace-property.context.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/property/workspace-property.context.ts @@ -45,14 +45,15 @@ export class UmbWorkspacePropertyContext { //private _host: UmbControllerHostInterface; - private _data: UniqueBehaviorSubject>; + private _providerController: UmbContextProviderController; - public readonly alias: Observable['alias']>; - public readonly label: Observable['label']>; - public readonly description: Observable['description']>; - public readonly value: Observable['value']>; - public readonly config: Observable['config']>; + private _data: UniqueBehaviorSubject> = new UniqueBehaviorSubject({} as WorkspacePropertyData); + public readonly alias = CreateObservablePart(this._data, data => data.alias); + public readonly label = CreateObservablePart(this._data, data => data.label); + public readonly description = CreateObservablePart(this._data, data => data.description); + public readonly value = CreateObservablePart(this._data, data => data.value); + public readonly config = CreateObservablePart(this._data, data => data.config); constructor(host:UmbControllerHostInterface) { @@ -62,16 +63,7 @@ export class UmbWorkspacePropertyContext { // Ensuring the property editor value-property is updated... // How about consuming a workspace context? When received maybe assuming these will fit or test if it likes to accept this property.. - this._data = new UniqueBehaviorSubject({} as WorkspacePropertyData); - - this.alias = CreateObservablePart(this._data, data => data.alias); - this.label = CreateObservablePart(this._data, data => data.label); - this.description = CreateObservablePart(this._data, data => data.description); - this.value = CreateObservablePart(this._data, data => data.value); - this.config = CreateObservablePart(this._data, data => data.config); - - - new UmbContextProviderController(host, 'umbPropertyContext', this); + this._providerController = new UmbContextProviderController(host, 'umbPropertyContext', this); } @@ -109,6 +101,7 @@ export class UmbWorkspacePropertyContext { // TODO: how can we make sure to call this. public destroy(): void { this._data.unsubscribe(); + this._providerController.destroy(); // This would also be handled by the controller host, but if someone wanted to replace/remove this context without the host being destroyed. Then we have clean up out selfs here. } }