Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Support infinite loading in actuators via Load More button #126

Open
metagrover opened this issue Dec 4, 2017 · 4 comments
Open

Support infinite loading in actuators via Load More button #126

metagrover opened this issue Dec 4, 2017 · 4 comments
Assignees
Milestone

Comments

@metagrover
Copy link
Contributor

screen shot 2017-12-04 at 1 08 58 pm

@metagrover metagrover added this to the 2.0.0 milestone Dec 4, 2017
@metagrover metagrover modified the milestones: 2.0.0, 2.1.0 Dec 17, 2017
@siddharthlatest
Copy link
Member

siddharthlatest commented Jan 9, 2018

Spec:

showMore={(loadMore)=>(<ShowMoreComponent onClick={loadMore} />)}

or

showMore={true}

In the latter case, we will render a button to show the load more functionality.

  • This prop is only used if pagination prop is set to false.

@metagrover metagrover modified the milestones: 2.1.0, 2.4.0 Feb 21, 2018
@metagrover
Copy link
Contributor Author

How about:

showLoadMore={true}

renders a Load More button instead of performing infinite loading on scroll. And to customize the Load More button: use loadMoreLabel which will render the button text as

<loadMoreLabel> (count of items)

and to completely customise the rendering element:

loadMoreButton={(loadMore, count)=>(<ShowMoreComponent onClick={loadMore} />)}

@davidklebanoff
Copy link

Not to complicate things too much, but it may be worth keeping in mind some patterns I see fairly often: Sometimes websites use infinite loading for the first X records, and then popup the load more button after.

For example, I see a use case where 50 results are initially shown, and each time the user scrolls near the bottom of the results, 50 more results are loaded via infinite scroll. However, after they hit 500, the "load more" button pops up. 50 additional results can be loaded each time it's clicked. This provides lazy loading results, infinite scrolling advantages, and helps throttle requests in the more extreme cases of aggressive scrolling.

If you want to get even fancier with the functionality, you could provide a property that is a functional hook that allows the function to determine when to show "load more" label by returning a boolean. This way developers could have ultimate control of when to invoke the "load more" button and could do more advanced algorithms like exponential back off. (e.g. Load up to 500 results the first time, 250 the second, 100 the third, and then 50 for each remaining click.)

@metagrover
Copy link
Contributor Author

That's a really good point. While this is also achievable by the API spec I proposed (since all the props can be dynamically plugged-in), I think we can also expose this as a prop that can accept a threshold count value.

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

No branches or pull requests

3 participants