-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
False-positive mutation warning #7424
Comments
Yea, we should probably use |
Also having issues with this as well. I'm using Draft JS. Specifically with ordered and unordered list items. When I add either list block styles to a line, I receive a similar error:
It's being caused on line 32:
It seems as if the shadowChildren array is empty but the element.props.children length is 1. I followed the example here: https://github.com/facebook/draft-js/blob/master/examples/rich/rich.html although it is slightly modified using React.createClass({}) and is modularized into several separate files. However, even when I copy and paste the example in, I'm still getting an error. Any ideas on why this may be occurring? |
cc @keyanzhang as you were looking at shadow children |
+1 |
having this issue as well |
+1 |
2 similar comments
+1 |
+1 |
Could you please stop +1-ing? The issue is confirmed, the fix is here: #7455 |
(You can instead just add a reaction directly to the original post, which makes it easier for us to sort by popularity) |
+1 I'm simply doing a sort before passing to .map: ` render : function(){ ` |
This is a mutation, and is NOT a false positive. If you need a new array that you are going to mutate, you should create a copy of the old one. Do not mutate React's data. |
I meet this problem too,It is the same reason. Thank for you sharing。 |
This issue has been closed, but the original test case still produces the warning for me (using jsfiddle via https://jsfiddle.net/reactjs/69z2wepo/) |
The issue gets closed when the bug is fixed in master. By looking at the issue history, you will see that it got closed by #7455. If you open that PR and look at it milestone, it says "15.4.0". This means that when 15.4.0 is out as a stable version, the issue will be fixed. In the meantime you can already use |
Ah, I missed the "in #7455"; sorry. Thanks for the clarification. |
No worries! Hopefully we'll get it out within a week or two but RC should be perfectly usable. |
Discovered that this warning, `Component's children should not be mutated` is a [known false positive](facebook/react#7424) in React 15.3.0 when passing `NaN` into a DOM component. It's fixed in 15.4 but I'm not happy about getting `NaN` here anyway. Turns out we were computing an invalid transform matrix for the visualization when it's not visible. All we have to do is early-out on that recomputation when we know we've got bad dimensions (meaning the svg isn't visible, or something is terribly wrong).
Given the following test case
Produces the following warning:
This is probably caused by this mutation check, which was introduced in 15.3.0, but it doesn't work for NaN, because NaN != NaN
The text was updated successfully, but these errors were encountered: