Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property '$updater' of undefined #82

Closed
tysonnero opened this issue Nov 6, 2016 · 9 comments
Closed

Cannot read property '$updater' of undefined #82

tysonnero opened this issue Nov 6, 2016 · 9 comments

Comments

@tysonnero
Copy link

Uncaught TypeError: Cannot read property '$updater' of undefined

When I include the below in my webpack.config to use react-lite in place of react, I rec'ing the above error. When I remove react-lite, my app works as expected.

Is there any good way of debugging this?

resolve: {
    alias: {
      'react': 'react-lite',
      'react-dom': 'react-lite'
    }
  }
@tysonnero
Copy link
Author

screen shot 2016-11-06 at 2 27 54 pm

The uid it's looking for (57) does not exist in node.cache. There uid's that are in cache are 62 and 66. One is the component which should be being loaded and the other is Connect.

@tysonnero
Copy link
Author

As I dug in a little more, I found that this is happening after dispatching a redux action from the componentWillReceiveProps of the component. Not really sure what else to look for.

@tysonnero
Copy link
Author

I move the dispatch out of componentWillReceiveProps to another area of the application, and the issue has gone away. Although fixed, I'm going to leave open to see if anyone can give me some insight into why this would have happened. Thanks!

@roastlechon
Copy link

I have this issue too

@roastlechon
Copy link

A quick glance at our code shows that none of our code is dispatching a redux action in the componentWillReceiveProps lifecycle directly or indirectly.

@beholderrk
Copy link
Contributor

beholderrk commented Dec 12, 2016

I suppose the problem here
14c164b#diff-33385622f0cbc5bbb7cd88879f6a81acR269

If component have componentWillReceiveProps (like react-redux connect component) then updateVcomponent function crash updater.isPending flag. Even if updater.isPending is true always will be set to false after this code

    if (component.componentWillReceiveProps) {
        updater.isPending = true
        component.componentWillReceiveProps(nextProps, componentContext)
        updater.isPending = false
    }

As result updateVcomponent may executed many many times when it should't.
When I remove updater.isPending = true updater.isPending = false it solve this issue.

Why it's necessary to toggle the flag if a component has componentWillReceiveProps?

@Lucifier129
Copy link
Owner

Lucifier129 commented Dec 13, 2016

@beholderrk when updater.isPending === true, component.setState will not cause rendering directly, and setState in life-cycle method componentWillReceiveProps should not cause rendering

beholderrk added a commit to beholderrk/react-lite that referenced this issue Dec 13, 2016
@beholderrk
Copy link
Contributor

pr #88

@Lucifier129
Copy link
Owner

@beholderrk Thanks PR, it can be merged safely, and v0.15.29 now has been released;)

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

No branches or pull requests

4 participants