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(fetch): use pages for pagination instead of cursor #4402

Merged
merged 4 commits into from
Nov 13, 2023

Conversation

rozenmd
Copy link
Contributor

@rozenmd rozenmd commented Nov 8, 2023

Fixes #4349

What this PR solves / how to test:

The existing fetchListResult handler for fetching potentially paginated results doesn't work for endpoints that don't implement cursor.

This PR adds a naive handler that uses page, assuming result_info provided by the endpoint contains page, per_page, and total

FYI @celso

Copy link

changeset-bot bot commented Nov 8, 2023

🦋 Changeset detected

Latest commit: 790d61a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
wrangler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@rozenmd rozenmd marked this pull request as ready for review November 8, 2023 12:35
@rozenmd rozenmd requested a review from a team as a code owner November 8, 2023 12:35
@petebacondarwin
Copy link
Contributor

Since it is hard to write automated test for this, I recommend pulling this down and somehow testing it manually before merging.

Copy link
Contributor

github-actions bot commented Nov 8, 2023

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6849645063/npm-package-wrangler-4402

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/6849645063/npm-package-wrangler-4402

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6849645063/npm-package-wrangler-4402 dev path/to/script.js
Additional artifacts:
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6849645063/npm-package-miniflare-4402
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/6849645063/npm-package-cloudflare-pages-shared-4402

Note that these links will no longer work once the GitHub Actions artifact expires.


wrangler@3.15.0 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20231025.1
workerd 1.20231030.0 1.20231030.0
workerd --version 1.20231030.0 2023-10-30

|

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

Copy link

codecov bot commented Nov 8, 2023

Codecov Report

Merging #4402 (790d61a) into main (789491b) will increase coverage by 0.21%.
Report is 11 commits behind head on main.
The diff coverage is 96.96%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4402      +/-   ##
==========================================
+ Coverage   75.28%   75.50%   +0.21%     
==========================================
  Files         223      225       +2     
  Lines       12357    12478     +121     
  Branches     3198     3239      +41     
==========================================
+ Hits         9303     9421     +118     
- Misses       3054     3057       +3     
Files Coverage Δ
packages/wrangler/src/user/choose-account.tsx 100.00% <100.00%> (ø)
packages/wrangler/src/whoami.ts 81.25% <100.00%> (ø)
packages/wrangler/src/cfetch/index.ts 90.29% <96.55%> (-0.25%) ⬇️

... and 9 files with indirect coverage changes

Copy link
Contributor

@penalosa penalosa left a comment

Choose a reason for hiding this comment

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

This should also be used when fetching the list of accounts for wrangler whoami

@rozenmd rozenmd requested review from penalosa and a team November 13, 2023 11:18
@rozenmd
Copy link
Contributor Author

rozenmd commented Nov 13, 2023

Cheers @penalosa 🙌

@rozenmd rozenmd merged commit baa76e7 into main Nov 13, 2023
17 checks passed
@rozenmd rozenmd deleted the rozenmd/fix-pagination branch November 13, 2023 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

🐛 BUG: wrangler login only lists the first 20 accounts
3 participants