Jelajahi Sumber

Fix auto-loading of more articles (#4593)

Fix regression from https://github.com/FreshRSS/FreshRSS/pull/4532
https://github.com/FreshRSS/FreshRSS/issues/3974
Alexandre Alapetite 3 tahun lalu
induk
melakukan
f1854cd0ae
1 mengubah file dengan 6 tambahan dan 3 penghapusan
  1. 6 3
      p/scripts/main.js

+ 6 - 3
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();
+			}
 		}
 	}
 }