From bae5a92131efb30de6f2452f2a19f497920654cc Mon Sep 17 00:00:00 2001 From: Bradley Walters Date: Mon, 7 Dec 2020 00:53:56 -0700 Subject: [PATCH] Fix redirect from / to /packages breaking browser back button (#248) Previously, navigating to https://search.nixos.org/ would use history.pushState to redirect to /packages and add a new entry to the browser history. This meant that if you pressed the back button, you would navigate back to / which would of course then redirect to /packages again. Now history.replaceState is used instead of pushState, so the / history entry is replaced entirely by a /packages history entry and the back button works. --- src/Main.elm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Main.elm b/src/Main.elm index d0a1f86..0fdfb91 100644 --- a/src/Main.elm +++ b/src/Main.elm @@ -202,7 +202,7 @@ changeRouteTo currentModel url = Route.Home -> -- Always redirect to /packages until we have something to show -- on the home page - ( model, Browser.Navigation.pushUrl model.navKey "/packages" ) + ( model, Browser.Navigation.replaceUrl model.navKey "/packages" ) Route.Packages searchArgs -> let