Skip to content
Snippets Groups Projects
Commit 4fbe2787 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

app-shell: preserve the "extra" path components when changing the routing state

In case the current language changes or the current activity is re-selected in the
menu we don't want to lose the extra trailing path components.
parent 5546931d
No related branches found
No related tags found
No related merge requests found
Pipeline #192183 passed
......@@ -200,10 +200,10 @@ export class AppShell extends ScopedElementsMixin(DBPLitElement) {
},
{
name: 'mainRoute',
path: ['/:component', '/:component/(.*)'],
path: ['/:component/:extra*'],
action: (context, params) => {
let componentTag = params.component.toLowerCase();
let extra = params[0] ? params[0].split('/') : [];
let extra = params.extra ?? [];
return {
lang: params.lang,
component: componentTag,
......@@ -958,12 +958,19 @@ export class AppShell extends ScopedElementsMixin(DBPLitElement) {
// build the menu
let menuTemplates = [];
for (let routingName of this.visibleRoutes) {
let partialState = {
component: routingName,
};
// clear the extra state for everything but the current activity
if (this.activeView !== routingName) {
partialState['extra'] = [];
}
menuTemplates.push(
html`
<li>
<a
@click="${(e) => this.onMenuItemClick(e)}"
href="${this.router.getPathname({component: routingName})}"
href="${this.router.getPathname(partialState)}"
data-nav
class="${getSelectClasses(routingName)}"
title="${this.metaDataText(routingName, 'description')}">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment