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

"Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op." has no context #3878

Closed
dantman opened this issue May 14, 2015 · 17 comments

Comments

@dantman
Copy link
Contributor

dantman commented May 14, 2015

The "Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op." warning contains no context of what component setState was run on.

setState can happen at any time and changes to another component can be the cause of an unmount that results in the setState happening when unmounted so it's hard to even link the most recent code chagne you made to what setState call is responsible.

Simply including the displayName in the message like other warnings have should help devs at least a little in tracking down the source of this warning.

@zpao
Copy link
Member

zpao commented May 16, 2015

This sounds like a great idea.

@evankline
Copy link

+1

3 similar comments
@machiaveli88
Copy link

+1

@tennisrodman
Copy link

+1

@jgod
Copy link

jgod commented May 19, 2015

+1

@zpao
Copy link
Member

zpao commented May 19, 2015

Please stop +1ing, it adds zero value. We have already identified that this is a good idea.

@dantman
Copy link
Contributor Author

dantman commented May 19, 2015

GitHub really needs to automatically consolidate +1 comments into a single block and do a digest email for +1s.

@edvinerikson
Copy link
Contributor

Got an PR for this: #3913

New message will be like this:

Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. Please check the code for the ExampleApplication component. This is a no-op.

@edvinerikson
Copy link
Contributor

PR is merged so we should probably close this now.

@zpao
Copy link
Member

zpao commented Jun 5, 2015

Thanks for taking this on!

@zpao zpao closed this as completed Jun 5, 2015
@seanchen1991
Copy link

Is the new context-sensitive warning working for everyone? I'm getting the old warning without any context on 0.13.3.

@zpao
Copy link
Member

zpao commented Jul 11, 2015

#3913 was not shipped to 0.13.x

@gilsho
Copy link

gilsho commented Jul 25, 2015

+1

1 similar comment
@enadav
Copy link

enadav commented Jul 25, 2015

+1

@zpao
Copy link
Member

zpao commented Jul 25, 2015

The fix was landed, any additional +1 is pure noise. Please stop.

@AndrewBestbier
Copy link

+1 ;)

@axelg12
Copy link

axelg12 commented Aug 10, 2015

+1

@facebook facebook locked and limited conversation to collaborators Aug 11, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests