Node.js based forum software built for the modern web
fix: update ajaxifyTimer logic to only drop the request if the URL is the same as the one it's already processing
Julian Lamb4297cd8f065
diff --git a/public/src/ajaxify.js b/public/src/ajaxify.jsindex bff7a330f2..8423f27fd8 100644--- a/public/src/ajaxify.js+++ b/public/src/ajaxify.js@@ -17,6 +17,7 @@ ajaxify.widgets = { render: render };ajaxify.count = 0;ajaxify.currentPage = null;+ ajaxify.requestedPage = null;// disables scroll to top when back button is clicked// https://developer.chrome.com/blog/history-api-scroll-restoration/if ('scrollRestoration' in history) {@@ -38,10 +39,11 @@ ajaxify.widgets = { render: render };}// Abort subsequent requests if clicked multiple times within a short window of time- if (ajaxifyTimer && (Date.now() - ajaxifyTimer) < 500) {+ if (ajaxify.requestedPage === url && ajaxifyTimer && (Date.now() - ajaxifyTimer) < 500) {return true;}ajaxifyTimer = Date.now();+ ajaxify.requestedPage = url;if (ajaxify.handleRedirects(url)) {return true;@@ -134,6 +136,7 @@ ajaxify.widgets = { render: render };ajaxify.updateHistory = function (url, quiet) {ajaxify.currentPage = url.split(/[?#]/)[0];+ ajaxify.requestedPage = null;if (window.history && window.history.pushState) {window.history[!quiet ? 'pushState' : 'replaceState']({url: url,