-
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
Switching from dangerouslySetInnerHTML to children #1232
Comments
It only happens when @kcarnold It may be good to know that AFAIK the recommended way of dealing with children is |
If If I use the way you recommend (which I'd prefer!), I get a warning: |
Thanks for reporting. I verified that #1157 doesn't fix this (even though it fixes another bug that produces the same error message). |
This happens because we enqueue a removal of the children, then set the HTML before the queued removal happens. When the queue is processed, the element is missing which confuses React. If we queue the innerHTML set as well then this will be fixed. @kcarnold As a workaround for this bug, you can assign a different |
@spicyj Do you know if this is fixed in master? I think it is... |
No, it's still broken (but it throws a slightly different error). |
Just spent a few hours chasing this bug down in our codebase. Would be good to fix this soon, before someone else runs into this. I can repro in all versions of React from 0.9 to 0.12. (This is what I ended up btw: http://jsfiddle.net/yw2t9hcm/) |
Any update on this issue? We're running into a similar problem. |
I also ran into this issue recently. I had to wrap the child in a |
Issue still occurring for me |
With this, ReactMultiChild handles all of the children-related operations for ReactDOMComponent so that we don't process operations out of order. This is necessary because ReactMultiChild does its own batching so there's no way without its cooperation to get the timing right here. Ideally we'll factor this logic out a bit better in subsequent updates but this is the simplest way to fix facebook#1232 which has embarrassingly been open for over a year.
Fix switching between dangerouslySetInnerHTML and children
Hi guys, got an issue on dangerouslySetInnerHTML my problem is it decode the HTML entities but it doesn't apply the style or properties. |
@juztinlazaro If you believe you've found a bug in the React core, please open a new issue and provide a jsfiddle (simplified testcase/example) that demonstrates the bug. |
@jimfb thanks sir, here's my https://jsfiddle.net/up8j9aqz/1/ |
@juztinlazaro It doesn't decode the entities. It puts them into the markup, directly (that's what |
@jimfb oh sorry, okay i understand now, newbie here. Okay maybe i need to decode it first before using dangerously. thanks sir. |
@juztinlazaro Ok, for future reference, usage questions are better answered on StackOverflow, as we try to keep github issues for tracking bugs in the React core. |
@jimfb okay thanks sir. |
I tripped on a strange error when, in one state, a component uses HTML to specify children (from rendering Markdown) and in another state it uses child components (for interactive content, itself with some inner HTML). I reduced the testcase down to this: http://jsfiddle.net/BCp36/1/
The text was updated successfully, but these errors were encountered: