diff options
author | Alan Pearce | 2024-05-09 14:54:32 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-09 14:54:32 +0200 |
commit | 453ae8569ab58fcc4ad61c461adc4489b9443cf8 (patch) | |
tree | 04697411d5cd9327f6bc3069a9276ee0145d5aac /frontend/static | |
parent | 4c06f763f471f51a655b8437f9529149512e5507 (diff) | |
download | searchix-453ae8569ab58fcc4ad61c461adc4489b9443cf8.tar.lz searchix-453ae8569ab58fcc4ad61c461adc4489b9443cf8.tar.zst searchix-453ae8569ab58fcc4ad61c461adc4489b9443cf8.zip |
fix(js): pushstate also on errors, so that the user can refresh
Diffstat (limited to 'frontend/static')
-rw-r--r-- | frontend/static/search.js | 7 |
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); }); } |