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

"pageStart"cannot be initialized when i change tabs?

Open EvalGitHub opened this issue 7 years ago • 1 comments

Describe the bug "pageStart"cannot be initialized

Expected behavior there are three tabs in my page. when i change tabs , "pageStart" should be initialized .

EvalGitHub avatar Sep 20 '18 10:09 EvalGitHub

@EvalGitHub
I ran into the same issue.

And yes, it cannot be re-initialized to 0. I came up with a workaround: you can first set "hasMore" to false, then manually fetch the data from page 0.

Like this:

componentDidUpdate = (prevProps, prevState) => {
    if (prevProps.filter !== this.props.filter) {
      this.setState({ hasMore: false, posts: [] }, () => {
        this.loadPosts(0);
      });
    }
  };

mhijack avatar Feb 26 '19 21:02 mhijack