From ffbeb0d45be9c661fe3b3723d2855d0972bdb762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Thu, 8 Feb 2024 14:05:24 +0100 Subject: [PATCH] use routerBasePath as target --- .../src/shared/router/route.context.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/shared/router/route.context.ts b/src/Umbraco.Web.UI.Client/src/shared/router/route.context.ts index ef53d3c172..3919d638f3 100644 --- a/src/Umbraco.Web.UI.Client/src/shared/router/route.context.ts +++ b/src/Umbraco.Web.UI.Client/src/shared/router/route.context.ts @@ -78,11 +78,9 @@ export class UmbRouteContext extends UmbBaseController { This means if the same type of modal is opened multiple times, the url will be cleaned from the last opened modal. This is okay for now as we do not have any situations where we close a parent modal before a child modal. */ - const currentUrl = window.location.href; - const folderToRemove = info.match.fragments.consumed; - if (currentUrl.includes(folderToRemove)) { - const lastIndex = currentUrl.lastIndexOf(folderToRemove); - window.history.pushState({}, '', currentUrl.slice(0, lastIndex)); + const folderToRemove = info.match.match.input; + if (folderToRemove && window.location.href.includes(folderToRemove)) { + window.history.pushState({}, '', this.#routerBasePath); } }