aboutsummaryrefslogtreecommitdiffstats
path: root/frontend-vanilla/src/main.ts
diff options
context:
space:
mode:
Diffstat (limited to 'frontend-vanilla/src/main.ts')
-rw-r--r--frontend-vanilla/src/main.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/frontend-vanilla/src/main.ts b/frontend-vanilla/src/main.ts
index 5f8056c..bdd0e97 100644
--- a/frontend-vanilla/src/main.ts
+++ b/frontend-vanilla/src/main.ts
@@ -270,15 +270,15 @@ export function renderItems() {
// Use the actual scroll container as IntersectionObserver root
const scrollRoot = document.getElementById('main-content');
- // Setup infinite scroll
+ // Setup infinite scroll — stored in itemObserver so it has a GC root and won't be collected
const sentinel = document.getElementById('load-more-sentinel');
if (sentinel) {
- const observer = new IntersectionObserver((entries) => {
+ itemObserver = new IntersectionObserver((entries) => {
if (entries[0].isIntersecting && !store.loading && store.hasMore) {
loadMore();
}
}, { root: scrollRoot, threshold: 0.1 });
- observer.observe(sentinel);
+ itemObserver.observe(sentinel);
}
// Scroll listener for reading items