dependency-land icon indicating copy to clipboard operation
dependency-land copied to clipboard

Add Infinite scroll

Open kbariotis opened this issue 8 years ago • 7 comments

This is my take to resolve #17.

Thank you :)

kbariotis avatar Feb 18 '17 16:02 kbariotis

@kbariotis wow, this looks really awesome 😃

Did you look into if it would be possible to load more results automatically as the user scrolls towards the end of the list? - instead of having to click a button (like twitter)

watson avatar Feb 22 '17 15:02 watson

Hello @watson! Thx!

Aw I completely missed that! Well, I guess It would be possible. The only thing that concerns me is that the initial request must fetch so many items that can fill the user's viewport, so she can scroll down and fetch more. We can fetch the user's device on runtime and decide how many to fetch, and then fetch a fixed amount of items for each additional request.

Sounds good? What do you think?

kbariotis avatar Feb 22 '17 21:02 kbariotis

I see your point, but let's just keep it pragmatic.

There's a header of 350 pixels above the first result and each result is 44 pixels. So how about just fetching 50 results each time? That would allow for a resolution of 2550 pixels vertically not counting the browser chrome. A newer 27" monitor in portrait orientation have 2560 pixels vertically, so that should be ok.

We could just keep the button but click it programatically when ever the user approaches the end of the list. That way if for some reason the automatic click doesn't fire, the user can just click it him self 😃

watson avatar Feb 23 '17 09:02 watson

Absolutely! Lets try it.

kbariotis avatar Feb 23 '17 09:02 kbariotis

Ready @watson! I kinda duplicate the runSearch function to create one to be used only for the loading more functionality. Is it acceptable? I could try to refactor it.

kbariotis avatar Feb 23 '17 10:02 kbariotis

LGTM 😃 - Any input @vanjacosic?

watson avatar Feb 23 '17 13:02 watson

Any update on this @watson @vanjacosic ?

kbariotis avatar Apr 03 '17 15:04 kbariotis