-
Notifications
You must be signed in to change notification settings - Fork 47k
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
React will not render tbody components. Returns "Uncaught Error: Invariant Violation: findComponentRoot(..., .0): Unable to find element. This probably means the DOM was unexpectedly mutated..." #3762
Comments
|
That's not the case. Like I mentioned in IRC, i'm starting with an existing table with an empty tbody, like this:
|
Render will not replace the |
The React.render documentation (https://facebook.github.io/react/docs/top-level-api.html#react.render) states that the contents of the container node (in this case,
Is that somehow not the case for a |
The docs are correct. The "container node" is in your case the |
Yeah, unfortunately there's no way for you to manage only the tbody in React for the reasons already mentioned. |
(two tbodies is actually completely valid, i'll point out, more to be a troll than anything, though it is true) |
@StoneCypher That's true but it doesn't help here. |
@spicyj
I have no idea how to solve it. |
@scarletsky If you can post a simple jsbin that shows the problem (in a new GitHub issue, ideally), I'll be happy to take a look. |
@spicyj After two days debugging, I can sure that the error is related to 73L-78L. |
Thanks for the solid test case. I have not confirmed, but I believe this is also a manifestation of #2410. I believe it would be fixed if you instead added and removed rows in the stores in response to CHANGE_TABLE_ROWS directly (and drop ADD_ROW and REMOVE_ROW completely) instead of chaining actions together in componentWillReceiveProps. What you're doing here is generally considered a Flux antipattern and also ties your code to your views more, which makes it harder to refactor your code later. I'll leave this open until I can confirm that this is in fact a dupe of #2410. |
Yeah, I'm 95% sure this is #2410. |
Not sure whether it is related to #2410. But I know that if However, if |
In fact, I am implementing a spreadsheet like excel with react.
As you see, when I change table's rows, I will dispatch You say What I do above is antipattern. Should my |
@scarletsky I am not a flux expert, sorry – but my understanding is that chaining actions is always discouraged. |
That's how Redux apps should work, yes. |
@gaearon thanks for the information. |
Fixes facebook#2410. Fixes facebook#6371. Fixes facebook#6538. I also manually tested the codepen in facebook#3762 and verified it now works.
Fixes facebook#2410. Fixes facebook#6371. Fixes facebook#6538. I also manually tested the codepen in facebook#3762 and verified it now works.
Problem:
(fiddle here: http://jsfiddle.net/davecorning/4wq4ycbn/2/)
I am attempting to dynamically update an existing html table with Ajax data.
I have 3 components: a Tbody component which renders a collection of DataRows (representing a collection of
<tr>
elements), each of which renders a collection of Cells (representing all the<td>
elements in a row).I understand that if there is an html table without a tbody element, browsers will insert one and cause problems, but that's not what's happening here. I have an html table with a tbody that I wish to replace.
I get the following error when I run the code:
The code succeeds if I simply change it to render a table (on top of a table element, of course).
I am running both Firefox 37.0.1 (linux) and Chrome 42.0.2311.90 + the ReactJS extension (in linux)
Any help would be appreciated.
Thanks,
-dave
The text was updated successfully, but these errors were encountered: