File tree 1 file changed +15
-6
lines changed
1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -143,12 +143,21 @@ export default class InfiniteScroll extends Component<Props, State> {
143
143
// do nothing when dataLength is unchanged
144
144
if ( this . props . dataLength === prevProps . dataLength ) return ;
145
145
146
- this . actionTriggered = false ;
147
-
148
- // update state when new data was sent in
149
- this . setState ( {
150
- showLoader : false ,
151
- } ) ;
146
+ const fetchAgain =
147
+ this . _infScroll &&
148
+ this . _scrollableNode &&
149
+ this . _scrollableNode . clientHeight > this . _infScroll . scrollHeight ;
150
+ if ( fetchAgain ) {
151
+ this . actionTriggered = true ;
152
+ this . setState ( { showLoader : true } ) ;
153
+ this . props . next ( ) ;
154
+ } else {
155
+ this . actionTriggered = false ;
156
+ // update state when new data was sent in
157
+ this . setState ( {
158
+ showLoader : false ,
159
+ } ) ;
160
+ }
152
161
}
153
162
154
163
static getDerivedStateFromProps ( nextProps : Props , prevState : State ) {
You can’t perform that action at this time.
0 commit comments