about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--frontend/static/search.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/frontend/static/search.js b/frontend/static/search.js
index 97a673e..edaf65f 100644
--- a/frontend/static/search.js
+++ b/frontend/static/search.js
@@ -74,8 +74,6 @@ function getResults(url) {
       }
     })
     .then(function (html) {
-      state.url = url.toJSON();
-      state.opened = [];
       state.fragment = html;
       history.pushState(state, null, url);
       return renderFragmentHTML(html);
@@ -84,6 +82,11 @@ function getResults(url) {
       range.deleteContents();
       range.insertNode(new Text(error.message));
       console.error("fetch failed", error);
+    })
+    .finally(function () {
+      state.url = url.toJSON();
+      state.opened = [];
+      history.pushState(state, null, url);
     });
 }