react-infinite-scroller icon indicating copy to clipboard operation
react-infinite-scroller copied to clipboard

a controlled props 'page' or allow 'loadMore' return a Promise

Open TiaossuP opened this issue 6 years ago • 0 comments

Is your feature request related to a problem? Please describe. the loadMore function will be fire multiple times even my previous loadMore has not finish yet

Describe the solution you'd like So I came up with 2 ways to solve this problem

  1. InfiniteScrolll can receive a new props: page and pass this.props.page +1 to loadMore function rather than this.pageLoaded += 1, than parent component can deal with page by itself
  2. allow loadMore function return a Promise object, and loadMore will not be firing again until previous Promise transform to a resolve/reject status

Describe alternatives you've considered In face, I can set a very small offset, as far as possible, to avoid invoke loadMore in multiple times, but it will damage normal user experience, So, i abandon this idea...

Additional context I think these 2 ways are both easy to implement, If need, I can submit a PR directly

TiaossuP avatar Feb 21 '19 12:02 TiaossuP