Fixed race condition in pager presenter
This commit is contained in:
parent
ea77a662ad
commit
25080fd977
1 changed files with 4 additions and 3 deletions
|
@ -52,7 +52,6 @@ App.Presenters.PagerPresenter = function(
|
|||
}
|
||||
|
||||
function reinit(params, loaded) {
|
||||
window.clearInterval(scrollInterval);
|
||||
if (forceClear) {
|
||||
clearContent();
|
||||
}
|
||||
|
@ -122,6 +121,7 @@ App.Presenters.PagerPresenter = function(
|
|||
}
|
||||
|
||||
function clearContent() {
|
||||
detachNextPageLoader();
|
||||
updateCallback({entities: [], totalRecords: 0}, true);
|
||||
}
|
||||
|
||||
|
@ -130,14 +130,15 @@ App.Presenters.PagerPresenter = function(
|
|||
return;
|
||||
}
|
||||
|
||||
window.clearInterval(scrollInterval);
|
||||
detachNextPageLoader();
|
||||
scrollInterval = window.setInterval(function() {
|
||||
var myScrollInterval = scrollInterval;
|
||||
var baseLine = $target.offset().top + $target.innerHeight();
|
||||
var scrollY = jQuery(window).scrollTop() + jQuery(window).height();
|
||||
if (scrollY > baseLine) {
|
||||
pager.nextPage();
|
||||
syncUrlInplace();
|
||||
window.clearInterval(scrollInterval);
|
||||
window.clearInterval(myScrollInterval);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue