all repos — searchix @ 453ae8569ab58fcc4ad61c461adc4489b9443cf8

Search engine for NixOS, nix-darwin, home-manager and NUR users

fix(js): pushstate also on errors, so that the user can refresh

Alan Pearce
commit

453ae8569ab58fcc4ad61c461adc4489b9443cf8

parent

4c06f763f471f51a655b8437f9529149512e5507

1 file changed, 5 insertions(+), 2 deletions(-)

jump to
M frontend/static/search.jsfrontend/static/search.js
@@ -74,8 +74,6 @@ throw new Error(`${res.status} ${res.statusText}: ${await res.text()}`);
} }) .then(function (html) { - state.url = url.toJSON(); - state.opened = []; state.fragment = html; history.pushState(state, null, url); return renderFragmentHTML(html);
@@ -84,6 +82,11 @@ .catch(function (error) {
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); }); }