summaryrefslogtreecommitdiff
path: root/client/js/router.js
diff options
context:
space:
mode:
authorHunternif <hunternif@gmail.com>2022-07-22 23:56:51 +0100
committerHunternif <hunternif@gmail.com>2022-07-23 00:51:28 +0100
commite443f46e33bdf4d58ebbf6784eec227abf4e6f47 (patch)
tree62065a5415314b67067ebde12ddf8df39b4ac3f7 /client/js/router.js
parent5c253e44e10222c4042d65fcc5d935ed6a9c3d17 (diff)
client: clear endless scroll cache on page refresh
Diffstat (limited to 'client/js/router.js')
-rw-r--r--client/js/router.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/client/js/router.js b/client/js/router.js
index 460a641..7ba52e3 100644
--- a/client/js/router.js
+++ b/client/js/router.js
@@ -157,7 +157,10 @@ class Router {
window.addEventListener("popstate", this._onPopState, false);
document.addEventListener(clickEvent, this._onClick, false);
const url = location.pathname + location.search + location.hash;
- return this.replace(url, history.state, true);
+ // clear cached page data, in case we are refreshing the page:
+ const initialState = Object.assign({}, history.state);
+ delete initialState.cachedPageData;
+ return this.replace(url, initialState, true);
}
stop() {
@@ -208,7 +211,7 @@ class Router {
const callChain = (this.ctx ? this._exits : []).concat(
[swap],
this._callbacks,
- [this._unhandled, (ctx, next) => {}]
+ [this._unhandled, (ctx, next) => { }]
);
let i = 0;