You've already forked AstralRinth
forked from didirus/AstralRinth
fix: broken infinite query on files.vue (#5133)
This commit is contained in:
@@ -237,7 +237,7 @@ function navigateToFolder() {
|
|||||||
const newPath = currentPath.endsWith('/')
|
const newPath = currentPath.endsWith('/')
|
||||||
? `${currentPath}${props.name}`
|
? `${currentPath}${props.name}`
|
||||||
: `${currentPath}/${props.name}`
|
: `${currentPath}/${props.name}`
|
||||||
router.push({ query: { path: newPath, page: 1 } })
|
router.push({ query: { path: newPath } })
|
||||||
}
|
}
|
||||||
|
|
||||||
const isNavigating = ref(false)
|
const isNavigating = ref(false)
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ function navigateToFolder() {
|
|||||||
const newPath = currentPath.endsWith('/')
|
const newPath = currentPath.endsWith('/')
|
||||||
? `${currentPath}${props.name}`
|
? `${currentPath}${props.name}`
|
||||||
: `${currentPath}/${props.name}`
|
: `${currentPath}/${props.name}`
|
||||||
router.push({ query: { path: newPath, page: 1 } })
|
router.push({ query: { path: newPath } })
|
||||||
}
|
}
|
||||||
|
|
||||||
const isNavigating = ref(false)
|
const isNavigating = ref(false)
|
||||||
|
|||||||
@@ -424,8 +424,15 @@ const {
|
|||||||
return client.kyros.files_v0.listDirectory(currentPath.value, pageParam, 100)
|
return client.kyros.files_v0.listDirectory(currentPath.value, pageParam, 100)
|
||||||
},
|
},
|
||||||
getNextPageParam: (lastPage, allPages) => {
|
getNextPageParam: (lastPage, allPages) => {
|
||||||
const totalFetched = allPages.reduce((sum, page) => sum + page.items.length, 0)
|
const pageSize = 100
|
||||||
return totalFetched < lastPage.total ? allPages.length + 1 : undefined
|
if (lastPage.items.length >= pageSize) {
|
||||||
|
return allPages.length + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastPage.current < lastPage.total) {
|
||||||
|
return lastPage.current + 1
|
||||||
|
}
|
||||||
|
return undefined
|
||||||
},
|
},
|
||||||
staleTime: 30_000,
|
staleTime: 30_000,
|
||||||
initialPageParam: 1,
|
initialPageParam: 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user