fix: piefed pageination starting at 0
This commit is contained in:
6 files changed
+24
-17
No files matched your search
@@ -19,22 +19,16 @@
|
||||
let { nodes = $bindable(), post }: Props = $props()
|
||||
|
||||
async function fetchChildren(parent: CommentNodeI) {
|
||||
if (
|
||||
!(
|
||||
parent.comment_view.counts.child_count > 0 &&
|
||||
parent.children.length == 0
|
||||
)
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
parent.loading = true
|
||||
parent.page ??= 1
|
||||
|
||||
const newComments = await client().getComments({
|
||||
max_depth: 5,
|
||||
max_depth: 3,
|
||||
parent_id: parent.comment_view.comment.id,
|
||||
type_: 'All',
|
||||
limit: 1000000,
|
||||
page: parent.page++,
|
||||
})
|
||||
|
||||
if (newComments.comments.length == 0) {
|
||||
@@ -45,6 +39,12 @@
|
||||
return
|
||||
}
|
||||
|
||||
if (
|
||||
newComments.comments.length >= parent.comment_view.counts.child_count
|
||||
) {
|
||||
parent.hasMore = false
|
||||
}
|
||||
|
||||
parent.children = buildCommentsTree(
|
||||
newComments.comments,
|
||||
parent.depth,
|
||||
@@ -97,7 +97,7 @@
|
||||
shadow="none"
|
||||
loaderWidth={16}
|
||||
onclick={() => {
|
||||
if (nodes[index].depth > 4) {
|
||||
if (nodes[index].depth > 6) {
|
||||
goto(`/comment/${nodes[index].comment_view.comment.id}#comments`)
|
||||
} else {
|
||||
nodes[index].loading = true
|
||||
|
||||
Reference in new issue
Block a user