mapbox / mapbox/mapbox-sdk-js

Pagination doesn't work correctly for service.listTileset() method

Open
#428 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
768
Forks
191
PR merge metrics
No merged PRs in 30d

Description

Pagination doesn't work correctly if we add any options to the request, e.g. `type` or `visibility`. Here is an example of code (I'm not sure how to create an executable example without exposing my access token):

```js
const service = tilesetsService({accessToken: ''})

const response = await service.listTilesets({
ownerId: '',
type: 'vector',
visibility: 'private',
limit: 5
}).send()

await response.nextPage().send()
```
The first request works fine, but the second one returns code `400` and message

```
The requested url's querystring "type" property must equal "raster" or "vector".
```
Without `type`, `visibility`, and `limit` options, everything works great!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the service.listTilesets() example, using type, visibility, and limit before calling response.nextPage().send(). Inspect how pagination builds the follow-up request and verify that the original options are preserved; done means the second request succeeds with the same filters and limit.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.