From 1c81f7e344a4fdd5a3aec0612f5ba325b64fbad9 Mon Sep 17 00:00:00 2001
From: Patrizio Bekerle <patrizio@bekerle.com>
Date: Mon, 21 Jun 2021 09:59:04 +0200
Subject: [PATCH] Don't push /root on the browser history

---
 packages/app-shell/src/router.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/packages/app-shell/src/router.js b/packages/app-shell/src/router.js
index 8f90830a..c05b899c 100644
--- a/packages/app-shell/src/router.js
+++ b/packages/app-shell/src/router.js
@@ -44,7 +44,9 @@ export class Router {
             // In case of a router redirect, set the new location
             if (newPathname !== oldPathName) {
                 const referrerUrl = location.href;
-                window.history.replaceState({}, '', newPathname);
+                if (!newPathname.endsWith('/root')) {
+                    window.history.replaceState({}, '', newPathname);
+                }
                 this.dispatchLocationChanged(referrerUrl);
             }
             this.setState(page);
@@ -66,7 +68,9 @@ export class Router {
             if (newPathname === oldPathname)
                 return;
             const referrerUrl = location.href;
-            window.history.pushState({}, '', newPathname);
+            if (!newPathname.endsWith('/root')) {
+                window.history.pushState({}, '', newPathname);
+            }
             this.dispatchLocationChanged(referrerUrl);
         });
     }
-- 
GitLab