Loading
fix(pagination): stop ScanAndCollectN before fetching an unneeded page
Fixes #2309 (closed)
ScanAndCollectN checked its limit only when the next item arrived. After collecting n items it still requested the next page, which caused two
problems:
- One extra API call whenever
nitems had been collected and another page existed. - If that extra request failed, the
nitems already collected were thrown away and the error was returned.