diff --git a/src/renderers/dom/client/ReactDOMComponentTree.js b/src/renderers/dom/client/ReactDOMComponentTree.js index 53d29d2dca..bf939b703c 100644 --- a/src/renderers/dom/client/ReactDOMComponentTree.js +++ b/src/renderers/dom/client/ReactDOMComponentTree.js @@ -64,7 +64,10 @@ function uncacheNode(inst) { * node every time. * * Since we update `_renderedChildren` and the actual DOM at (slightly) - * different times, we could race here and not get the + * different times, we could race here and see a newer `_renderedChildren` than + * the DOM nodes we see. To avoid this, ReactMultiChild calls + * `prepareToManageChildren` before we change `_renderedChildren`, at which + * time the container's child nodes are always cached (until it unmounts). */ function precacheChildNodes(inst, node) { if (inst._flags & Flags.hasCachedChildNodes) { diff --git a/src/renderers/dom/shared/ReactDOMComponent.js b/src/renderers/dom/shared/ReactDOMComponent.js index 740c2c91f7..adb78247ed 100644 --- a/src/renderers/dom/shared/ReactDOMComponent.js +++ b/src/renderers/dom/shared/ReactDOMComponent.js @@ -1201,7 +1201,8 @@ assign( prepareToManageChildren: function() { // Before we add, remove, or reorder the children of a node, make sure // we have references to all of its children so we don't lose them, even - // if nefarious browser plugins add extra nodes to our tree. + // if nefarious browser plugins add extra nodes to our tree. This could be + // called once per child so it should be fast. ReactDOMComponentTree.precacheChildNodes(this, getNode(this)); }, }