]> git.ardis.lu - ardislu.dev/commitdiff
Fix bug where in-memory pages are served midscroll
authorArdis Lu <ardisglu@gmail.com>
Fri, 11 Aug 2023 04:30:48 +0000 (21:30 -0700)
committerArdis Lu <ardisglu@gmail.com>
Fri, 11 Aug 2023 04:30:48 +0000 (21:30 -0700)
script.js

index b52754efabaff01e4fe393a5e7c5a8ad7c587fe0..ef88dec7b1fc919fd34a136a5b9df395699d7051 100644 (file)
--- a/script.js
+++ b/script.js
@@ -302,6 +302,9 @@ function route(href) {
   else {
     history.pushState({}, '', url);
     showPage(url.pathname);
+    // Reset scroll to simulate new page load when an in-memory page is served
+    // This does not affect the back/forward button
+    scroll(0, 0);
   }
 }
 
This page took 0.050237 seconds and 4 git commands to generate.