Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

a warning and a problem #65

Open
gitdust opened this issue Dec 1, 2017 · 4 comments
Open

a warning and a problem #65

gitdust opened this issue Dec 1, 2017 · 4 comments

Comments

@gitdust
Copy link

gitdust commented Dec 1, 2017

warning as below:
image
an a problem is that when I start a fetch in React component's lifecycle, this fetch never ends.

@alexander-akait
Copy link
Member

@gitdust can you create minimum reproducible test repo?

@gitdust
Copy link
Author

gitdust commented Dec 5, 2017

actually I use this demo to code spliting,it seems that the problem is in this demo.My project is so big, I'll try my best to create a test repo.

@RedJue
Copy link

RedJue commented Jan 9, 2018

I have the same problem, this is my solution.

this.state = {
      isMounted: false
    }
 componentDidMount() {
    this.setState({ isMounted: true })
  }
  componentWillUnmount() {
    this.setState({ isMounted: false })
  }
load(props) {
    this.setState({
      mod: null
    })
    props.load((mod) => {
      if (this.state.isMounted) {
        this.setState({
          // handle both es imports and cjs
          mod: mod.default ? mod.default : mod
        })
      }
    })
  }

I hope this works

@gitdust
Copy link
Author

gitdust commented Jan 10, 2018

@RedJue it worked for me,thanks very much.
But still have any clue about this infinite fetch.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants