Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Pagination buttons don't update after clicking "Next" #426

Closed
christophfriedrich opened this issue Apr 4, 2024 · 4 comments
Closed

Pagination buttons don't update after clicking "Next" #426

christophfriedrich opened this issue Apr 4, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@christophfriedrich
Copy link

christophfriedrich commented Apr 4, 2024

I'm using version 3.2.0-beta.1 at https://radiantearth.github.io/stac-browser/

I made a search request returning 14 items:

grafik

Here's the request, although I doubt it's specific to this query: POST https://earth-search.aws.element84.com/v1/search with {"datetime":"2024-03-04T20:00:00.000Z/2024-03-22T20:00:00.000Z","bbox":[13.171234130859377,53.81200414120256,13.274230957031252,53.85252660044951],"limit":12,"collections":["sentinel-2-c1-l2a"]}

Those 14 items are paginated into pages of 12 items each, so initially the previous/next buttons perfectly look like this:

grafik

But after clicking on "Next", the buttons stay the same:

grafik

So that I can't go back to the previous page. To reach there, I have to re-submit the search, which at least works.

But I can go forward again, leading to this state:

grafik

@christophfriedrich
Copy link
Author

While searching in a neighbouring area where the result included only 7 matches, I spotted that the "Next" button remains active even when there is no second page at all:

grafik

@m-mohr m-mohr added the bug Something isn't working label Apr 14, 2024
@m-mohr m-mohr added this to the 3.2.0 milestone Apr 14, 2024
@m-mohr m-mohr self-assigned this Apr 14, 2024
@m-mohr
Copy link
Collaborator

m-mohr commented Apr 14, 2024

Thanks for the report.

  • The previous link is not working because the API doesn't provide a "prev" or "previous" link in their response.
  • Similarly, the API the API does provide a next link although the next page returns no results.

I'm closing here because it's an API issue, which should be reported to Earth Search directly.
@matthewhanson @philvarner fyi

@m-mohr m-mohr closed this as not planned Won't fix, can't repro, duplicate, stale Apr 14, 2024
@m-mohr m-mohr removed the bug Something isn't working label Apr 14, 2024
@philvarner
Copy link

I think this should be reopened.

Earth Search does not provide a prev link because the database does not support that form of pagination (at least easily and robustly), but the prev link is optional for pagination. I think stac-browser should conditionally show the Previous button only if there is a prev link in the response.

As for the issue with Next, pagination will typically result in an empty last page, since the server code doesn't know that it has paginated through all of the results until it gets an empty result set from the database. I think this could be made more clear in stac-browser, since the last page displays the "no results were found for this filter" rather than a message that is more specific to pagination, e.g., "no more results available".

@m-mohr
Copy link
Collaborator

m-mohr commented Apr 15, 2024

@philvarner The prev / first page links are disabled if the server doesn't provide them. This is to avoid that the buttons move around too much. If you go through the pages quickly, you may click the wrong button because a prev button was added on the second page which is still under your mouse where you expect the next button to be. STAC Browser can't detect upfront which link types are supported by the API. UI elements should be placed in a way that users don't accidentially click the wrong button because the UI changed... So this is working as planned and actually designed with the E84 UX team. ;-)

For the next link: If the limit is 12 and the result is 7, why can't you remove the next link? If there are 5 unfilled spots, you can clearly know that there's obviously not another page otherwise you'd have received more results.

Nevertheless, the text will show "No further items available." now if an empty result has been recevied after the first page.

@m-mohr m-mohr closed this as completed Apr 15, 2024
@m-mohr m-mohr added the enhancement New feature or request label Apr 15, 2024
silvester-pari pushed a commit to EOEPCA/open-science-catalog-stac-browser that referenced this issue May 29, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants