dcurletti/redux-infinite-scroll

If neither containerHeight nor elementIsScrollable are set, either give error or assume elementIsScrollable = false

Closed this issue · 3 comments

I've been struggling in the past few days with the library calling loadMore function indefinitely on startup and I couldn't figure out the reason.

turns out its because I neither set elementIsScrollable nor containerHeight. since elementIsScrollable defaults to true , containerHeight is required by default but no errors are reported if containerHeight wasn't provided.

Yea this is a very annoying problem and a pretty large barrier to entry for people adopting the library. The issue is that there is a scenario where you wrap <InfiniteScroll /> inside of a div with a fixed height, making the library work out of the box (which is how I used to use it). That is why I updated the Readme and placed the IMPORTANT text https://github.com/RealScout/redux-infinite-scroll/blob/master/Readme.md#usage. Having said that, I do agree that something needs to change, either a disclaimer higher in the ReadMe, or one of the two solutions you suggested.

Thanks!

Best solution: In the PropTypes, conditionally add isRequired to ContainerHeight if elementIsScrollable = true

Yes, I have seen the important part but I thought to myself nah I am using window scrollbar so I don't need to define anything. turns out I am wrong, If I want to use window scrollbar I still need to explicitly define elementIsScrollable