document
This commit is contained in:
committed by
Jacob Overgaard
parent
5f4bd89c3d
commit
8b44f46534
@@ -141,13 +141,23 @@ export class UmbDocumentWorkspaceContext
|
||||
async load(unique: string) {
|
||||
this.resetState();
|
||||
this.#getDataPromise = this.repository.requestByUnique(unique);
|
||||
const { data } = await this.#getDataPromise;
|
||||
if (!data) return undefined;
|
||||
type GetDataType = Awaited<ReturnType<UmbDocumentDetailRepository['requestByUnique']>>;
|
||||
const { data, asObservable } = (await this.#getDataPromise) as GetDataType;
|
||||
|
||||
this.setIsNew(false);
|
||||
this.#persistedData.setValue(data);
|
||||
this.#currentData.setValue(data);
|
||||
return data || undefined;
|
||||
if (data) {
|
||||
this.setIsNew(false);
|
||||
this.#persistedData.update(data);
|
||||
this.#currentData.update(data);
|
||||
}
|
||||
|
||||
this.observe(asObservable(), (entity) => this.#onStoreChange(entity), 'umbDocumentStoreObserver');
|
||||
}
|
||||
|
||||
#onStoreChange(entity: EntityType | undefined) {
|
||||
if (!entity) {
|
||||
//TODO: This solution is alright for now. But reconsider when we introduce signal-r
|
||||
history.pushState(null, '', 'section/content');
|
||||
}
|
||||
}
|
||||
|
||||
async create(parent: { entityType: string; unique: string | null }, documentTypeUnique: string) {
|
||||
|
||||
Reference in New Issue
Block a user