From 547f829f5baab7629823beb343b70a467c32ae5b Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 21 Jan 2019 21:16:34 -0800 Subject: [PATCH] Fix panels with subpaths (#2528) --- src/layouts/partial-panel-resolver.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/layouts/partial-panel-resolver.ts b/src/layouts/partial-panel-resolver.ts index 90b3ccb01f..97be0f8be4 100644 --- a/src/layouts/partial-panel-resolver.ts +++ b/src/layouts/partial-panel-resolver.ts @@ -177,10 +177,16 @@ class PartialPanelResolver extends LitElement { // Manual splitting const route = this.route!; const dividerPos = route.path.indexOf("/", 1); - this._routeTail = { - prefix: route.path.substr(0, dividerPos), - path: route.path.substr(dividerPos), - }; + this._routeTail = + dividerPos === -1 + ? { + prefix: route.path, + path: "", + } + : { + prefix: route.path.substr(0, dividerPos), + path: route.path.substr(dividerPos), + }; // If just route changed, no need to process further. if (changedProps.size === 1) {