From 453ae8569ab58fcc4ad61c461adc4489b9443cf8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Thu, 9 May 2024 14:54:32 +0200 Subject: fix(js): pushstate also on errors, so that the user can refresh --- frontend/static/search.js | 7 +++++-- 1 file 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); }); } -- cgit 1.4.1