Skip to content

feat(shared): add pageSlice pagination helper#1

Open
DorianZheng wants to merge 1 commit into
mainfrom
test-boxlite-review
Open

feat(shared): add pageSlice pagination helper#1
DorianZheng wants to merge 1 commit into
mainfrom
test-boxlite-review

Conversation

@DorianZheng

Copy link
Copy Markdown
Member

Adds a pagination helper. Opening this to test the @Boxlite reviewer.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@DorianZheng, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 13 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 19d0bf12-4216-49ea-b57a-93a3cc40e199

📥 Commits

Reviewing files that changed from the base of the PR and between c2b179f and aefa3de.

📒 Files selected for processing (1)
  • packages/shared/src/pagination.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test-boxlite-review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions 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.

📦 BoxLite review — 1 issue

/** Return the items on `page` (1-indexed) for a given `pageSize`. */
export function pageSlice<T>(items: readonly T[], page: number, pageSize: number): T[] {
// page is 1-indexed: page 1 => items[0 .. pageSize-1]
const start = page * pageSize

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛑 pageSlice off-by-one skips first page
Ran extracted fn: pageSlice([1,2,3,4,5,6],1,2) returns [3,4] not [1,2]; docstring says page 1 => items[0..pageSize-1] but start=page*pageSize instead of (page-1)*pageSize.

Suggested change
const start = page * pageSize
const start = (page - 1) * pageSize

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

📦 BoxLite review — 1 issue · aefa3de

packages/shared/src/pagination.ts
  pageSlice  +6/-0  new pagination helper, off-by-one bug

reviewed aefa3de in a BoxLite microVM · @boxlite review to re-run · powered by BoxLite

@DorianZheng

Copy link
Copy Markdown
Member Author

@boxlite-agent review

1 similar comment
@DorianZheng

Copy link
Copy Markdown
Member Author

@boxlite-agent review

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