fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ea9d7d1
)
fix race in filters
author
Radek Czajka
<rczajka@rczajka.pl>
Fri, 9 Jun 2023 15:49:36 +0000
(17:49 +0200)
committer
Radek Czajka
<rczajka@rczajka.pl>
Fri, 9 Jun 2023 15:49:36 +0000
(17:49 +0200)
src/catalogue/static/2022/book/filter.js
patch
|
blob
|
history
diff --git
a/src/catalogue/static/2022/book/filter.js
b/src/catalogue/static/2022/book/filter.js
index
59e810a
..
43b6c4e
100644
(file)
--- a/
src/catalogue/static/2022/book/filter.js
+++ b/
src/catalogue/static/2022/book/filter.js
@@
-8,10
+8,17
@@
function get_page(page, search, ordering, callback) {
get_page_by_url('.?page=' + page + '&order=' + ordering + '&search=' + search, callback);
}
function get_page(page, search, ordering, callback) {
get_page_by_url('.?page=' + page + '&order=' + ordering + '&search=' + search, callback);
}
+
+ let lastFulfilledPage = 0;
+
function get_page_by_url(url, callback) {
function get_page_by_url(url, callback) {
+ let requestTime = + new Date();
$.get(
url,
function(data) {
$.get(
url,
function(data) {
+ if (lastFulfilledPage > requestTime) return;
+ lastFulfilledPage = requestTime;
+
html = $(data);
objectList = $('#object-list', html);
paginate = $('#paginate', html);
html = $(data);
objectList = $('#object-list', html);
paginate = $('#paginate', html);