Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wrong reply size #117

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ build {
}

halo {
version = "2.14.0"
version = "2.15.0-rc.1"
}
12 changes: 9 additions & 3 deletions packages/comment-widget/src/comment-replies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class CommentReplies extends LitElement {
this.page = 1;
}

const queryParams = [`page=${this.page || 0}`, `size=${this.replySize}`];
const queryParams = [`page=${this.page || 1}`, `size=${this.replySize}`];

const response = await fetch(
`${this.baseUrl}/apis/api.halo.run/v1alpha1/comments/${this.comment?.metadata.name}/reply?${queryParams.join('&')}`
Expand Down Expand Up @@ -122,8 +122,14 @@ export class CommentReplies extends LitElement {
}

async fetchNext() {
this.page++;
await this.fetchReplies({ append: true });
if (this.withReplies) {
// if withReplies is true, we need to reload the replies list
await this.fetchReplies({ append: !(this.page === 1) });
this.page++;
} else {
this.page++;
await this.fetchReplies({ append: true });
}
}

override connectedCallback(): void {
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/extensions/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ spec:
label: 基本设置
formSchema:
- $formkit: number
label: 默认加载评论条数
label: 评论分页条数
name: size
validation: required
value: 20
- $formkit: number
label: 默认加载回复条数
label: 回复分页条数
name: replySize
validation: required
value: 10
Expand Down
Loading