Changing the hasMore prop without loading data will not change the component
Hi, thanks for maintaining this project - it has allowed us to consider implementing infinite scroll when we would not have otherwise :smile:
I'm having some trouble. In our app, the definition of "reaching the end of the feed" is "making a request which returns an empty payload". We don't have a special param which indicates that the last page was served. Therefore, we make a request, find no data, change the "hasMore" prop to "false" and leave the dataLength as it was.
Unfortunately, in this circumstance the component will not reload. This leaves us with loading bubbles at the bottom of the feed. I believe the responsible code from index.tsx is below:
componentDidUpdate(prevProps: Props) {
// do nothing when dataLength is unchanged
if (this.props.dataLength === prevProps.dataLength) return;
this.actionTriggered = false;
// update state when new data was sent in
this.setState({
showLoader: false,
});
}
It feels like the check ought to be "this.props === prevProps", but maybe this causes issues with props like "next". Perhaps instead "hasMore" should be included in the list of "refreshable props"?
Please watch this video for this library https://youtu.be/c0nKjMnDfG4