Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Add pagination or infinite scroll to search results #17

Open
watson opened this issue Feb 17, 2017 · 1 comment · May be fixed by #18
Open

Add pagination or infinite scroll to search results #17

watson opened this issue Feb 17, 2017 · 1 comment · May be fixed by #18

Comments

@watson
Copy link
Member

watson commented Feb 17, 2017

Currently we load all search results from the server in one go. This becomes a problem when searching for a very popular package as it adds a huge drain on the server and takes a long time to display.

We just added pagination support to the api in 17d5bf1, but the UI needs to be updated to actually use it.

Gotcha

When doing pagination we don't know the total number of search results until the very end. It might be possible to get this number in some other way, but for know we shouldn't depend on it.

So since we don't know the total number of results, it's hard to do page-based pagination (since we don't know how many pages there is). So infinite scroll seems like a better solution right now.

API

The API supports two pagination query arguments:

  • limit - The number of results to return (default: -1, no limit)
  • gt - The name of the last dependent in the previous result

API Example

Request 1: /api/opbeat/*?limit=2

[{"name":"anyfetch-hydrater","version":"2.2.0","range":"^1.1.2"},
{"name":"anyfetch-provider","version":"3.1.2","range":"^1.1.2"}]

Request 2: /api/query/opbeat/*?limit=2&gt=anyfetch-provider

[{"name":"bunyan-opbeat","version":"1.0.3","range":"^3.6.6"},
{"name":"closeheat","version":"2.0.0","range":"^3.3.0"}]
@kbariotis kbariotis linked a pull request Feb 18, 2017 that will close this issue
@buritos
Copy link

buritos commented Feb 26, 2017

@watson I also took a stab at this one in #20

Let me know if you prefer this solution over #18 and your comments if you think something should be handled differently before merging

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants