From b6c89e548da79fb68db9ed1fdebb26d2ab74d501 Mon Sep 17 00:00:00 2001 From: cas Date: Fri, 24 Jul 2026 11:17:47 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20infinite=20scroll=20sneller=20=E2=80=94?= =?UTF-8?q?=20rootMargin=201200px=20+=203=20batches=20per=20trigger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Was: rootMargin=200px, 1 batch (50 items) per intersection trigger → bij snel scrollen moest je wachten of terugscrollen Nu: rootMargin=1200px, tot 3 batches (150 items) per trigger → sentinel wordt 1200px eerder gedetecteerd, batches pre-loaden agressief → sentinel blijft ver voor de viewport, nooit meer wachten --- docker/index.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docker/index.html b/docker/index.html index df9f937..3f8fe82 100644 --- a/docker/index.html +++ b/docker/index.html @@ -2771,9 +2771,16 @@ button:active, .btn:active, .meal-card-main:active, .dagboek-item:active, .food- searchObserver = new IntersectionObserver((entries) => { if (entries[0].isIntersecting) { - appendSearchBatch(allItems); + // Load up to 3 batches at once when user scrolls fast + // This keeps the sentinel pushed far ahead of the viewport + let batchesLoaded = 0; + const maxBatches = 3; + while (batchesLoaded < maxBatches && searchVisibleCount < allItems.length) { + appendSearchBatch(allItems); + batchesLoaded++; + } } - }, { rootMargin: '200px' }); + }, { rootMargin: '1200px' }); searchObserver.observe(sentinel); }