diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/document-workspace.context.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/document-workspace.context.ts index fabe2d7375..896d751989 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/document-workspace.context.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/workspace/document-workspace.context.ts @@ -30,6 +30,16 @@ export class UmbDocumentWorkspaceContext #documentTypeRepository: UmbDocumentTypeRepository; //#dataTypeRepository: UmbDataTypeRepository; + /** + * The document is the current stored version of the document. + * For now lets not share this publicly as it can become confusing. + * TODO: Use this to compare, for variants with changes. + */ + #document = new ObjectState(undefined); + + /** + * The document is the current state/draft version of the document. + */ #draft = new ObjectState(undefined); documentTypeKey = this.#draft.getObservablePart((data) => data?.contentTypeKey); @@ -60,6 +70,7 @@ export class UmbDocumentWorkspaceContext const { data } = await this.#documentRepository.requestByKey(entityKey); if (data) { this.#isNew = false; + this.#document.next(data); this.#draft.next(data); } } @@ -68,6 +79,7 @@ export class UmbDocumentWorkspaceContext const { data } = await this.#documentRepository.createDetailsScaffold(parentKey); if (!data) return; this.#isNew = true; + this.#document.next(data); this.#draft.next(data); }