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); }