Open spaceninja opened 4 years ago
I was able to work around this in my app by applying similar logic to that found here:
That said, on the Python app, the logic works by requesting 11 files and only displaying 10 of them. But in the API, we receive 10 files, so in order to use the same logic, I needed to set my app to only display 9 files at a time.
So if proper pagination is too big an ask, an alternate approach would be to allow specifying how many files to receive in an API request, so I could request 11 files.
Currently, the API does not return any pagination meta information when you request a
/before
or/after
endpoint. You get an array of files, but no information about how many total files there are, what page you're on, or whether there are any further pages. This means that if you're on the last page of results, you have no way of knowing that the next link you're adding will return an empty array, so your users have the suboptimal experience of hitting next and getting a "no posts" error.Ideally, in addition to the array of posts, the API would return a meta object that includes things like total number of posts (so you can construct a google-style paginated list of page numbers), and whether or not there is additional information in the prev/next direction.