Skip to content

fix: use the new cursor and page size when fetching the next page - #404

Merged
Justin Hammond (Justintime50) merged 5 commits into
EasyPost:masterfrom
pcbeingused33:fix/next-page-cursor
Nov 30, 2026
Merged

Justin Hammond (Justintime50) merged 5 commits into
EasyPost:masterfrom
pcbeingused33:fix/next-page-cursor

Conversation

@pcbeingused33

@pcbeingused33 Alex Castillo González (pcbeingused33) commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

getNextPage() can return the same page over and over, so a loop over pages never advances (description below, no linked issue).

The params of the previous request are stored in _params and merged on top of the new ones (array_merge($params, $userParams)), so an older before_id / after_id replaces the new cursor, and an older page_size replaces the $pageSize argument. This happens when the first call already contained a cursor, and also with a plain all(): the second page stores its own before_id in _params, so the third request asks for the second page again.

The previous params are now the base, and the new cursor (plus $pageSize when given) is applied after them, in BaseService::getNextPageResources and UserService::getNextPageOfChildren. Other filters are still carried over, but the opposite cursor is dropped (after_id on before_id pages, before_id on children pages), since the API rejects a request with both. ReportService::all() now stores _params too, so ReportService::getNextPage gets the same fix and keeps params such as page_size.

Also bumps the version to 8.10.1 and moves the changelog entry under v8.10.1.

Testing

The existing cassettes replay unchanged with the new param order; they were not re-recorded, since that needs EasyPost API keys. The full suite passes locally, and phpcs and phpstan pass.

Pull Request Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Improvement (fixing a typo, updating readme, renaming a variable name, etc)

This change was prepared with the help of an AI coding assistant.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Justintime50
Justin Hammond (Justintime50) merged commit 56baf79 into EasyPost:master Nov 30, 2026
7 checks passed
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.

3 participants