fix(knowledge): fill viewport on load when sentinel stays visible
This commit is contained in:
@@ -84,6 +84,16 @@ async function fetchItems(reset = false) {
|
|||||||
} finally {
|
} finally {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the sentinel is still in the viewport after appending, keep loading
|
||||||
|
if (!reset && items.value.length < total.value) {
|
||||||
|
await nextTick();
|
||||||
|
const rect = sentinelEl.value?.getBoundingClientRect();
|
||||||
|
if (rect && rect.top < window.innerHeight + 200) {
|
||||||
|
page.value++;
|
||||||
|
await fetchItems();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchTags() {
|
async function fetchTags() {
|
||||||
|
|||||||
Reference in New Issue
Block a user