question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pagination goes into infinite loop when querying empty lists

See original GitHub issue

When requesting a paginated resource with no values the paginator goes into an infinite loop of requests to the spotify api.

To reproduce the bug I made this query on a user with no public playlists

{
   user(id: "someid"){
    playlists{
      name
    }
  }
}

The api returns an empty list with total=0, but the !!iterator.total condition inside the shouldStopIterate function causes and infinite loop of requests.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
charlypolycommented, Feb 19, 2019

Hi @Skogsfrae,

Thanks for pointing this! 💯🙇

Please free to make a PR on this repo so I can review & publish it to npm 🚢

0reactions
charlypolycommented, Jan 11, 2021

Will take a look in spotify-graphql@4.0.0, cf: #79

Read more comments on GitHub >

github_iconTop Results From Across the Web

Infinite loop in PagingSource when response is empty using ...
My problem is that when the API response retrieve an empty list, instead of print nothing, it causes an infinite loop in my...
Read more >
A guide to pagination, load more buttons, and infinite scroll
Here, we explain a few methods of setting up pagination, load more buttons, and infinite scroll to create more dynamic web pages.
Read more >
Infinite loop in pagination (API) - Microsoft Power BI Community
So I have a loop for my API to iterate over as many pages that are available (in this case around 13 loops...
Read more >
Infinite Queries | TanStack Query Docs
When an infinite query becomes stale and needs to be refetched, each group is fetched sequentially , starting from the first one. This...
Read more >
Pagination in Power Query (Part 2) – JenKuntz.ca
The specific nuance here is ClickUp returns a list every time, it does not return null when you hit a page with no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found