dcurletti / redux-infinite-scroll

React infinite scroll component designed for a Redux data-flow.
MIT License
178 stars 47 forks source link

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

Closed ramast closed 8 years ago

ramast commented 8 years ago

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.

dcurletti commented 8 years ago

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!

dcurletti commented 8 years ago

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

ramast commented 8 years ago

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