Skip to content

Fix reply pagination after preloading - #221

Merged
ruibaby merged 1 commit into
mainfrom
fix/reply-pagination
Aug 20, 2026
Merged

Fix reply pagination after preloading#221
ruibaby merged 1 commit into
mainfrom
fix/reply-pagination

Conversation

@ruibaby

@ruibaby ruibaby commented Aug 20, 2026

Copy link
Copy Markdown
Member

What this PR does

  • Restore withReplySize as the initial reply preload size and clamp it to the configured reply page size
  • Reconcile a partially preloaded first page before loading subsequent pages
  • Load page two immediately when the initial preload already contains a full first page
  • Prevent duplicate load requests and only advance pagination after a successful response
  • Add reply size constraints and focused pagination regression tests

Reproduction

  1. Enable preloading replies with comments.
  2. Set the reply page size and initial preload size to the same value.
  3. Open a comment with more replies than the configured size and click Load more.

Before this change, the first click fetched page one again and displayed no new replies. After this change, the first click appends page two.

Testing

  • pnpm -C packages/comment-widget test
  • pnpm build
  • ./gradlew check

Fixes #122

修复回复分页条数与同时加载回复条数相同时,首次点击“加载更多”无法加载新回复的问题。

@ruibaby
ruibaby marked this pull request as ready for review August 20, 2026 08:53
@ruibaby
ruibaby merged commit c78b9ae into main Aug 20, 2026
1 check passed
@ruibaby
ruibaby deleted the fix/reply-pagination branch August 20, 2026 08:55

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce33f16dd0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

this.page = 1;
}
const page = options?.page ?? 1;
const size = options?.size ?? this.configMapData?.basic.replySize ?? 10;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clamp zero-sized legacy configurations before fetching

Existing installations can have replySize: 0 because the previous settings schema only required a value and imposed no minimum. Unlike the former || 10 fallback, ?? 10 preserves that zero, so this path sends size=0 to the reply endpoint; the same unnormalized value is also passed to getNextReplyRequest, breaking subsequent pagination. The new form constraint does not migrate saved settings, so normalize the configured page size to a positive fallback before using it.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

当 回复分页条数=同时加载回复的条数 首次点击加载更多按钮 并不会加载更多评论

1 participant