Open thomasboyt opened 9 years ago
wonder if there's a way to trigger some index-updating cycle on Main
, given that a child fragment changed...
this is, if nothing else, a predicted problem: https://github.com/facebook/react/issues/2127#issuecomment-108067345
[referencing nodes by mountIndex] does not work when one "node" can suddenly become any number of nodes and this may happen without invoking the parent and it may also happen several components deep (wrapping)
options:
nodeCount
changes, trigger some way to increase the nodeIndex
es of subsequent siblings
parent.updateNodeIndexes(thisIndex, newNodeCount)
The frustrating thing about accessing the parent is that there doesn't seem to be a good way to do it, at all.
I'm imagining a CompositeComponent storing a reference to its parent, somehow, but I don't know if the parent could change out from under it after initial mount. Looking up by root ID seems to be (a) impossible and (b) a super-gross hack even if it was.
This is pretty difficult & important.
When the following structure changes from:
to:
the only update cycle that gets called is for the first composite, and the second one doesn't know that a previous sibling fragment was updated, so its
_nodeIndex
is now off by one.