-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Here is a demo for my issue: http://jsbin.com/jepifofaha/edit?js,output (put it there because CodePen was giving me errors and was blocking the requests)
As you can notice after two requests, the page limit is reached and the API returns empty result but the InfiniteScroll isn't able to detect that and keeps sending requests infinitely.
_
An even bigger problem is when I use a Wordpress REST api endpoint (which I can't demonstrate here now), where when pagination exceeds total pages count, the request returns a HTTP 400 error which then blocks all my orher scripts and nothing else works after that.
_
Usually all these api endpoints return total pages count in the response header. The above demo returns "X_TOTAL_COUNT" in response header from which I can calculate total pages available and stop making new requests after pagination exceeds total pages available.
I'm pulling my hair out since yesterday and can't find a way to read response headers (you know basically XHR variable)
Any help or suggestion? Is it possible? Can you suggest any workaround?