From f1854cd0ae4bb41a7671a0efe9e3e483ead2a1c1 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 10 Sep 2022 07:54:56 +0200 Subject: Fix auto-loading of more articles (#4593) Fix regression from https://github.com/FreshRSS/FreshRSS/pull/4532 https://github.com/FreshRSS/FreshRSS/issues/3974 --- p/scripts/main.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/p/scripts/main.js b/p/scripts/main.js index 90e7d79c8..a9f0986de 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -726,9 +726,12 @@ function onScroll() { box_to_follow.scrollTop + box_to_follow.offsetHeight + (window.innerHeight / 2) >= streamFooter.offsetTop) { // Too close to the last pre-loaded article load_more_posts(); - } else if (document.querySelectorAll('.flux.current ~ .flux').length <= 5) { - // Too few pre-loaded articles - load_more_posts(); + } else { + const after = document.querySelectorAll('.flux.current ~ .flux').length; + if (after > 0 && after <= 5) { + // Too few pre-loaded articles + load_more_posts(); + } } } } -- cgit v1.2.3