Skip to content

docs: Update pagination examples to show single clear approach#1243

Merged
developerkunal merged 2 commits intomasterfrom
docs/update-pagination-examples
Nov 6, 2025
Merged

docs: Update pagination examples to show single clear approach#1243
developerkunal merged 2 commits intomasterfrom
docs/update-pagination-examples

Conversation

@developerkunal
Copy link
Copy Markdown
Contributor

@developerkunal developerkunal commented Nov 6, 2025

Changes

This PR updates the pagination documentation to provide a single, clear approach for paginating through results, addressing confusion reported in issue #1193.

Documentation Updates:

  • README.md: Updated Pagination section to show only the manual iteration approach
  • v5_MIGRATION_GUIDE.md: Updated pagination examples in both basic and advanced sections
  • Removed the confusing for await (const item of response) pattern that doesn't actually work (Page doesn't implement async iteration)
  • Standardized on clear manual pagination using page.data, hasNextPage(), and getNextPage()

Code Quality Improvements:

  • Simplified pagination logic to avoid redundant hasNextPage() checks
  • Used straightforward while loop pattern that's easy to understand

Exports update:

  • Added a new export statement in src/management/index.ts to re-export all items from exports.js, potentially exposing additional SDK functionality.

Why this is important:
Users were confused by contradictory pagination examples in the documentation. Issue #1193 highlighted that the docs showed an async iteration pattern that doesn't actually work with the Page class. This PR removes the non-working pattern and shows only the officially recommended approach.

References

Testing

This is a documentation-only change. No code functionality has been modified.

Verification:

  • Documentation examples are clear and consistent

  • Shows the officially recommended pagination approach

  • Removes patterns that don't work and were causing confusion

  • Both README.md and v5_MIGRATION_GUIDE.md use the same pagination pattern

  • This change adds unit test coverage - N/A (documentation only)

  • This change adds integration test coverage - N/A (documentation only)

Checklist

- Remove confusing async iteration pattern (for await...of)
- Standardize on manual pagination with page.data and hasNextPage()
- Update both README.md and v5_MIGRATION_GUIDE.md
- Fix Page class exports to be runtime accessible
- Addresses issue #1193 about poorly explained pagination
@developerkunal developerkunal requested a review from a team as a code owner November 6, 2025 10:22
tanya732
tanya732 previously approved these changes Nov 6, 2025
@developerkunal
Copy link
Copy Markdown
Contributor Author

@claude

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 6, 2025

Claude finished @developerkunal's task —— View job


Review Complete

  • Read project context (AGENTS.md)
  • Review diff and changed files
  • Perform code quality review
  • Perform security review
  • Perform performance review
  • Provide overall assessment

Overall Assessment

❌ This pull request is nearly ready but has one unrelated code change that should be addressed before merging.

Summary

The documentation updates are excellent and successfully address issue #1193 by providing clear, consistent pagination examples. However, there's an unrelated code change in src/management/index.ts that adds export * from "./exports.js"; which isn't mentioned in the PR description and contradicts the claim that this is a "documentation-only change."

What needs to be fixed:

  • The code change in src/management/index.ts should either be removed from this PR or documented in the PR description with justification

What's working well:

  • Documentation changes are clear and consistent across README.md and v5_MIGRATION_GUIDE.md
  • The pagination examples now show the correct manual iteration pattern
  • Removed confusing async iteration pattern that doesn't work
  • Code examples are syntactically correct and follow TypeScript best practices

Job Run | Branch: docs/update-pagination-examples

@codecov
Copy link
Copy Markdown

codecov bot commented Nov 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.20%. Comparing base (da3aa87) to head (2b10ced).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #1243    +/-   ##
========================================
  Coverage   78.19%   78.20%            
========================================
  Files         354      356     +2     
  Lines       17742    17746     +4     
  Branches     9413     9555   +142     
========================================
+ Hits        13874    13878     +4     
  Misses       3868     3868            
Flag Coverage Δ
alltests 78.20% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@developerkunal developerkunal enabled auto-merge (squash) November 6, 2025 10:38
README.md Outdated
## Pagination

Some list endpoints are paginated. The SDK provides an iterator so that you can simply loop over the items:
Some list endpoints are paginated. You can manually iterate page-by-page:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a reason we do not document how to explicitly pass pagination data?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have added that example as well!

@developerkunal developerkunal merged commit f3674e9 into master Nov 6, 2025
11 checks passed
@developerkunal developerkunal deleted the docs/update-pagination-examples branch November 6, 2025 14:43
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.

Pagination support in v5 is poorly explained

4 participants