perf: don't load unread page again if everything already loaded

this only applies when you have only 1-2 unread topics, side effect from https://github.com/NodeBB/NodeBB/pull/9525
This commit is contained in:
Barış Soner Uşaklı
2024-08-21 12:55:37 -04:00
parent bf6be3efc5
commit 4aad601967

View File

@@ -20,8 +20,9 @@ define('forum/infinitescroll', ['hooks', 'alerts', 'api'], function (hooks, aler
}
previousScrollTop = $(window).scrollTop();
$(window).off('scroll', startScrollTimeout).on('scroll', startScrollTimeout);
if ($body.height() <= $(window).height()) {
if ($body.height() <= $(window).height() && (
!ajaxify.data.hasOwnProperty('pageCount') || ajaxify.data.pageCount > 1
)) {
callback(1);
}
};