-
Notifications
You must be signed in to change notification settings - Fork 46.8k
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
dangerouslySetInnerHTML doesn't properly reconcile #377
Comments
One other tidbit: this only seems to happen when the |
What happens if you change step 2 to a |
I just reduced the test case to 19 lines. |
@petehunt: yeah changing 2) to use a span works as expected |
If anyone wants to look into this, the bug is probably here https://github.com/facebook/react/blob/master/src/core/ReactNativeComponent.js#L280 |
@brianr: I cannot reproduce what you are seeing: http://jsfiddle.net/vjeux/FwvMt/ It also bugs if I use a different string |
@vjeux I'm not able to reproduce that particular behavior given this small repro case. The original code had several more layers... will keep trying. |
There's no way that this can work if _updateDOMChildren doesn't know about dangerouslySetInnerHTML, so tell it. Fixes facebook#377.
I know this is a very old issue but I had a similar problem and came across this. I found that this problem occurs when you do not add a <div dangerouslySetInnerHTML={{__html : markdownText}} /> does not seem to work reproducibly, whereas <div key="some_unique_key" dangerouslySetInnerHTML={{__html : markdownText}} /> seems to. I think this could be related to React's diffing algorithm that might not properly treat a component with a |
thx @adewes you saved my day :-) |
Seems like the issue is back again. @adewes Thanks, solves the problem for me too. |
Took me a while to repro, but here you go: http://jsfiddle.net/LeZuse/uoff476z/2/ (ugly, but demonstrates the issue well) |
Thanks @adewes that was giving me fits! |
If anyone is still seeing issues on 0.14, please make a new issue with a simple repro case. |
I have this issue, but can't reproduce in a simple example - my original code is layered and I think that's the reason the real DOM doesn't reconcile. In the react debugger is looks as dangerouslySetInnerHTML has proper __html value, but it doesn't equeal to the innerHTML of the actual element. I used an extremely simple (and equally nasty) workaround. Writing it here just in case it will help someone:
|
Reading |
well, that's more like a control shot :-) |
Looks like the issue still exist in 16.4.1 when using |
If you experience something similar three years later, and the original issue is closed, you can be sure it's a different unrelated issue. :-) Please file a new one. We don't keep track of closed issues so your feedback is unfortunately going into the void. When filing a new issue, please provide a reproducing example.
This sounds like browsers work. You can't nest |
@sbezboro reported the following issue on IRC:
http://jsfiddle.net/vjeux/8vZ57/1/ (Both on master and 4.0)
The repro case is:
<div dangerouslySetInnerHTML={{__html: '<b>HTML</b>'}} />
<div>Text</div>
The div has its innerHTML empty instead of
<b>HTML</b>
.I don't really know what's going on. @jordwalke, @petehunt can you guys look at it?
The text was updated successfully, but these errors were encountered: