From 4b2d693824bc07e387336382f772c979bd7b77e2 Mon Sep 17 00:00:00 2001 From: Lucas Bach Bisgaard Date: Fri, 24 Oct 2025 09:56:06 +0200 Subject: [PATCH 1/3] Have to control of the state store navigation for custom sections or overrides --- .../components/backoffice-header-sections.element.ts | 7 +++++++ .../packages/core/section/extensions/section.extension.ts | 1 + 2 files changed, 8 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/src/apps/backoffice/components/backoffice-header-sections.element.ts b/src/Umbraco.Web.UI.Client/src/apps/backoffice/components/backoffice-header-sections.element.ts index 117867336b65..d77dfc21827e 100644 --- a/src/Umbraco.Web.UI.Client/src/apps/backoffice/components/backoffice-header-sections.element.ts +++ b/src/Umbraco.Web.UI.Client/src/apps/backoffice/components/backoffice-header-sections.element.ts @@ -71,6 +71,13 @@ export class UmbBackofficeHeaderSectionsElement extends UmbLitElement { event.stopPropagation(); event.preventDefault(); + // useNavigatingState is set false, then the navigation store state is disabled for the current sections + if (!(manifest?.meta.useNavigatingState ?? true)) { + const sectionPath = this.#getSectionPath(manifest); + history.pushState(null, '', sectionPath); + return; + } + // Store the current path for the section so we can redirect to it next time the section is visited if (this._currentSectionAlias) { const currentPath = window.location.pathname; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/section/extensions/section.extension.ts b/src/Umbraco.Web.UI.Client/src/packages/core/section/extensions/section.extension.ts index b3d90397f536..4e687ac8a4a1 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/section/extensions/section.extension.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/section/extensions/section.extension.ts @@ -12,4 +12,5 @@ export interface ManifestSection export interface MetaSection { label: string; pathname: string; + useNavigatingState?: boolean; } From 2c32d680ffb85c928e387870b80b392e0d30fc5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Wed, 29 Oct 2025 14:23:14 +0100 Subject: [PATCH 2/3] revert wording --- .../backoffice/components/backoffice-header-sections.element.ts | 2 +- .../src/packages/core/section/extensions/section.extension.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/apps/backoffice/components/backoffice-header-sections.element.ts b/src/Umbraco.Web.UI.Client/src/apps/backoffice/components/backoffice-header-sections.element.ts index d77dfc21827e..bc118199382c 100644 --- a/src/Umbraco.Web.UI.Client/src/apps/backoffice/components/backoffice-header-sections.element.ts +++ b/src/Umbraco.Web.UI.Client/src/apps/backoffice/components/backoffice-header-sections.element.ts @@ -72,7 +72,7 @@ export class UmbBackofficeHeaderSectionsElement extends UmbLitElement { event.preventDefault(); // useNavigatingState is set false, then the navigation store state is disabled for the current sections - if (!(manifest?.meta.useNavigatingState ?? true)) { + if (manifest?.meta.preventUrlRetention !== true) { const sectionPath = this.#getSectionPath(manifest); history.pushState(null, '', sectionPath); return; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/section/extensions/section.extension.ts b/src/Umbraco.Web.UI.Client/src/packages/core/section/extensions/section.extension.ts index 4e687ac8a4a1..cb64f73dc6a8 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/section/extensions/section.extension.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/section/extensions/section.extension.ts @@ -12,5 +12,5 @@ export interface ManifestSection export interface MetaSection { label: string; pathname: string; - useNavigatingState?: boolean; + preventUrlRetention?: boolean; } From bba555f371b9af29fe7bb0da920d6e2b8cbae342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Wed, 29 Oct 2025 14:44:42 +0100 Subject: [PATCH 3/3] move logic and update comment --- .../components/backoffice-header-sections.element.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/apps/backoffice/components/backoffice-header-sections.element.ts b/src/Umbraco.Web.UI.Client/src/apps/backoffice/components/backoffice-header-sections.element.ts index bc118199382c..d75a4ee5a62d 100644 --- a/src/Umbraco.Web.UI.Client/src/apps/backoffice/components/backoffice-header-sections.element.ts +++ b/src/Umbraco.Web.UI.Client/src/apps/backoffice/components/backoffice-header-sections.element.ts @@ -71,13 +71,6 @@ export class UmbBackofficeHeaderSectionsElement extends UmbLitElement { event.stopPropagation(); event.preventDefault(); - // useNavigatingState is set false, then the navigation store state is disabled for the current sections - if (manifest?.meta.preventUrlRetention !== true) { - const sectionPath = this.#getSectionPath(manifest); - history.pushState(null, '', sectionPath); - return; - } - // Store the current path for the section so we can redirect to it next time the section is visited if (this._currentSectionAlias) { const currentPath = window.location.pathname; @@ -90,8 +83,9 @@ export class UmbBackofficeHeaderSectionsElement extends UmbLitElement { const clickedSectionAlias = manifest.alias; - // If the clicked section is the same as the current section, we just load the original section path to load the section root - if (this._currentSectionAlias === clickedSectionAlias) { + // If preventUrlRetention is set to true then go to the section root. + // Or if the clicked section is the current active one, then navigate to the section root + if (manifest?.meta.preventUrlRetention === true || this._currentSectionAlias === clickedSectionAlias) { const sectionPath = this.#getSectionPath(manifest); history.pushState(null, '', sectionPath); return;