This commit is contained in:
Niels Lyngsø
2023-01-10 15:51:27 +01:00
parent 9a02b4026d
commit af83aabe6d

View File

@@ -8,11 +8,12 @@ import { UmbContextConsumerController } from 'src/core/context-api/consume/conte
import { UmbObserverController } from '@umbraco-cms/observable-api';
import { UmbContextProviderController } from 'src/core/context-api/provide/context-provider.controller';
import { EntityTreeItem } from '@umbraco-cms/backend-api';
import { ContentDetails } from '@umbraco-cms/models';
// TODO: Consider if its right to have this many class-inheritance of WorkspaceContext
// TODO: Could we extract this code into a 'Manager' of its own, which will be instantiated by the concrete Workspace Context. This will be more transparent and 'reuseable'
export abstract class UmbWorkspaceContentContext<
ContentTypeType extends EntityTreeItem = EntityTreeItem,
ContentTypeType extends ContentDetails = ContentDetails,
StoreType extends UmbNodeStoreBase<ContentTypeType> = UmbNodeStoreBase<ContentTypeType>
> {
@@ -96,7 +97,7 @@ export abstract class UmbWorkspaceContentContext<
if(!this.#isNew) {
this._storeSubscription?.destroy();
this._storeSubscription = new UmbObserverController(this._host, this._store.getByKey(this.entityKey),
this._storeSubscription = new UmbObserverController(this._host, this._store.getByKey(this.entityKey),
(content) => {
if (!content) return; // TODO: Handle nicely if there is no content data.
this.update(content as any);
@@ -134,4 +135,4 @@ export abstract class UmbWorkspaceContentContext<
public destroy(): void {
this._data.unsubscribe();
}
}
}