fix(knowledge): remove backup load check causing duplicate items on scroll
The IntersectionObserver fires as soon as it's created (sentinel immediately intersecting after page 1 renders), while the removed backup check also fires in the same tick — two concurrent fetchItems(page 2) calls produced duplicate cards. With sentinel now properly inside the scrolling root, the observer alone handles progressive loading. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -82,19 +82,6 @@ async function fetchItems(reset = false) {
|
|||||||
} finally {
|
} finally {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the sentinel is still visible in the card-grid after appending, keep loading
|
|
||||||
if (!reset && items.value.length < total.value) {
|
|
||||||
await nextTick();
|
|
||||||
if (sentinelEl.value && cardGridEl.value) {
|
|
||||||
const containerBottom = cardGridEl.value.getBoundingClientRect().bottom;
|
|
||||||
const sentinelTop = sentinelEl.value.getBoundingClientRect().top;
|
|
||||||
if (sentinelTop < containerBottom + 200) {
|
|
||||||
page.value++;
|
|
||||||
await fetchItems();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchTags() {
|
async function fetchTags() {
|
||||||
|
|||||||
Reference in New Issue
Block a user