Skip to content

Commit

Permalink
Merge pull request #5493 from spicyj/gh-4589
Browse files Browse the repository at this point in the history
Finish comment in ReactDOMComponentTree
  • Loading branch information
sophiebits committed Nov 17, 2015
2 parents 892352e + 6c89857 commit e03df26
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/renderers/dom/client/ReactDOMComponentTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion src/renderers/dom/shared/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
},
}
Expand Down

0 comments on commit e03df26

Please sign in to comment.