Esri/arcgis-rest-js

Improve documentation for nextPage() fuctions

Open

#1,206 opened on Mar 18, 2025

 (2 comments) (1 reaction) (0 assignees)TypeScript (126 forks)auto 404
good first issue

Repository metrics

Stars
 (389 stars)
PR merge metrics
 (PR metrics pending)

Description

Description

We should update the docs for the various method that support nextPage() function. This means:

We should also document the pattern to paginate thorough resuts to get all results which generally looks like this:

function async getAllResults (response) {
 let allItems = lastResponse.results;

  // Keep getting the next page until there are no more pages.
  while (lastResponse.nextPage) {
    lastResponse = await lastResponse.nextPage();
    allItems = allItems.concat(lastResponse.results);
  }

  return allItems;
}

const allResults = await searchItems(options).then(getAllResults)

Link to page

No response

Contributor guide