You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're writing a WYSIWYG editor in React, and in order to place a cursor inside the rich document we use contentEditable. Understandably, React doesn't fare well with contentEditable - to get around the framework's confusion once contentEditable children are modified, we force re-renders with new keys and do other work to restore the selection. In practice, we have this working pretty well.
With 0.12, we're getting the new warning:
A component is contentEditable and contains children managed by React. It is now your responsibility to guarantee that none of these nodes are unexpectedly modified or duplicated. This is probably not intentional.
In our case, we do guarantee that nodes are unexpectedly modified or duplicated, and it is intentional. Is there any way to suppress that warning? Unlike the Factory warning, this warning appears each time the component is instantiated (I think) - at the very least, it slowly fills up our consoles.
(We've considered an alternative of not using children on the contentEditable, and on component update we set the innerHTML outside of React - this would likely sidestep the warning, but not get us much else.)
The text was updated successfully, but these errors were encountered:
Ah, a team member pointed out React warns when we use children but NOT dangerouslySetInnerHTML, and it turns out most of our calls use dangerouslySetInnerHTML - only a few places use children, and those places are all text nodes. In this case, we'll likely switch those latter cases to using dangerouslySetInnerHTML as well, so I'll close this task for now.
Obviously, welcome to re-open if you think suppressing the warning is something worth considering.
We're writing a WYSIWYG editor in React, and in order to place a cursor inside the rich document we use
contentEditable
. Understandably, React doesn't fare well with contentEditable - to get around the framework's confusion once contentEditable children are modified, we force re-renders with new keys and do other work to restore the selection. In practice, we have this working pretty well.With 0.12, we're getting the new warning:
In our case, we do guarantee that nodes are unexpectedly modified or duplicated, and it is intentional. Is there any way to suppress that warning? Unlike the Factory warning, this warning appears each time the component is instantiated (I think) - at the very least, it slowly fills up our consoles.
(We've considered an alternative of not using children on the contentEditable, and on component update we set the
innerHTML
outside of React - this would likely sidestep the warning, but not get us much else.)The text was updated successfully, but these errors were encountered: