Skip to content

Commit 8aa423a

Browse files
committed
implement master template state based on data
1 parent 239df08 commit 8aa423a

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/packages/templating/templates/workspace/template-workspace.context.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class UmbTemplateWorkspaceContext
4343
setup: (component: PageComponent, info: IRoutingInfo) => {
4444
const parentEntityType = info.match.params.entityType;
4545
const parentUnique = info.match.params.parentUnique === 'null' ? null : info.match.params.parentUnique;
46-
this.createScaffold({ parent: { entityType: parentEntityType, unique: parentUnique } });
46+
this.create({ entityType: parentEntityType, unique: parentUnique });
4747

4848
new UmbWorkspaceIsNewRedirectController(
4949
this,
@@ -63,6 +63,22 @@ export class UmbTemplateWorkspaceContext
6363
]);
6464
}
6565

66+
override async load(unique: string) {
67+
const response = await super.load(unique);
68+
if (response.data) {
69+
this.setMasterTemplate(response.data.masterTemplate?.unique ?? null);
70+
}
71+
return response;
72+
}
73+
74+
async create(parent: any) {
75+
const response = await this.createScaffold({ parent });
76+
77+
if (!parent) return;
78+
await this.setMasterTemplate(parent.unique);
79+
return response;
80+
}
81+
6682
setName(value: string) {
6783
this._data.updateCurrent({ name: value });
6884
}

0 commit comments

Comments
 (0)