Have to control of the state store navigation for custom sections or … (#20637)
* Have to control of the state store navigation for custom sections or overrides * revert wording * move logic and update comment --------- Co-authored-by: Lucas Bach Bisgaard <lucas.bisgaard@kraftvaerk.com> Co-authored-by: Niels Lyngsø <niels.lyngso@gmail.com>
This commit is contained in:
committed by
GitHub
parent
ce59537006
commit
7af67d2944
@@ -83,8 +83,9 @@ export class UmbBackofficeHeaderSectionsElement extends UmbLitElement {
|
|||||||
|
|
||||||
const clickedSectionAlias = manifest.alias;
|
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 preventUrlRetention is set to true then go to the section root.
|
||||||
if (this._currentSectionAlias === clickedSectionAlias) {
|
// 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);
|
const sectionPath = this.#getSectionPath(manifest);
|
||||||
history.pushState(null, '', sectionPath);
|
history.pushState(null, '', sectionPath);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -12,4 +12,5 @@ export interface ManifestSection
|
|||||||
export interface MetaSection {
|
export interface MetaSection {
|
||||||
label: string;
|
label: string;
|
||||||
pathname: string;
|
pathname: string;
|
||||||
|
preventUrlRetention?: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user