fix: broken infinite query on files.vue (#5133)

This commit is contained in:
Calum H.
2026-01-16 09:03:56 +00:00
committed by GitHub
parent 75c5316dc3
commit 1ea96df00e
3 changed files with 11 additions and 4 deletions

View File

@@ -239,7 +239,7 @@ function navigateToFolder() {
const newPath = currentPath.endsWith('/')
? `${currentPath}${props.name}`
: `${currentPath}/${props.name}`
router.push({ query: { path: newPath, page: 1 } })
router.push({ query: { path: newPath } })
}
const isNavigating = ref(false)

View File

@@ -424,8 +424,15 @@ const {
return client.kyros.files_v0.listDirectory(currentPath.value, pageParam, 100)
},
getNextPageParam: (lastPage, allPages) => {
const totalFetched = allPages.reduce((sum, page) => sum + page.items.length, 0)
return totalFetched < lastPage.total ? allPages.length + 1 : undefined
const pageSize = 100
if (lastPage.items.length >= pageSize) {
return allPages.length + 1
}
if (lastPage.current < lastPage.total) {
return lastPage.current + 1
}
return undefined
},
staleTime: 30_000,
initialPageParam: 1,