From 59a34f6d494add23c1cc796f03fbc5d51a38258e Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Wed, 3 Sep 2025 16:09:35 +0200 Subject: [PATCH] V16: Creating a new sub template should not show Discard Changes dialog (#20068) fix: sets the masterTemplate at each opportunity to avoid Discard Changes dialog --- .../templates/workspace/template-workspace.context.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/workspace/template-workspace.context.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/workspace/template-workspace.context.ts index 4573c8bca2..35ff79bb43 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/templates/workspace/template-workspace.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/templates/workspace/template-workspace.context.ts @@ -67,15 +67,16 @@ export class UmbTemplateWorkspaceContext override async load(unique: string) { const response = await super.load(unique); - if (response.data) { - this.setMasterTemplate(response.data.masterTemplate?.unique ?? null); - } + await this.setMasterTemplate(response.data?.masterTemplate?.unique ?? null); return response; } async create(parent: UmbEntityModel) { const data = await this.createScaffold({ parent, + preset: { + masterTemplate: parent.unique ? { unique: parent.unique } : null, + }, }); // Set or reset the master template