From e443f46e33bdf4d58ebbf6784eec227abf4e6f47 Mon Sep 17 00:00:00 2001 From: Hunternif Date: Fri, 22 Jul 2022 23:56:51 +0100 Subject: client: clear endless scroll cache on page refresh --- client/js/router.js | 7 +++++-- 1 file 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; -- cgit v1.3