From 66f86bf1f700ab75bbf20b5758ebbf1e8d2cfdff Mon Sep 17 00:00:00 2001
From: Federico Brigante <github@bfred.it>
Date: Tue, 12 Nov 2019 22:17:59 +0700
Subject: [PATCH] Don't break the back button when redirecting legacy routes
 (#4305)

* Don't break the back button when redirecting legacy routes

* Prettier
---
 frontend/lib/redirect-legacy-routes.ts | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/frontend/lib/redirect-legacy-routes.ts b/frontend/lib/redirect-legacy-routes.ts
index 44eea5f11d..aebf7269c9 100644
--- a/frontend/lib/redirect-legacy-routes.ts
+++ b/frontend/lib/redirect-legacy-routes.ts
@@ -4,8 +4,12 @@ export default function redirectLegacyRoutes() {
   const { hash } = window.location
   if (hash && hash.startsWith('#/examples/')) {
     const category = hash.replace('#/examples/', '')
-    navigate(`category/${category}`)
+    navigate(`category/${category}`, {
+      replace: true,
+    })
   } else if (hash === '#/endpoint') {
-    navigate('endpoint')
+    navigate('endpoint', {
+      replace: true,
+    })
   }
 }
-- 
GitLab