Skip to content
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

When creating a child element in a fragment, it is inserted relative to the fragment's parent, not to the fragment's nodeIndex #5

Open
thomasboyt opened this issue Jun 3, 2015 · 1 comment

Comments

@thomasboyt
Copy link
Owner

Here's the problem:

The whole updateChildren index cycle thing is relative to the parent, but counts the nodes of the children. So it's able to properly place fragments, no problem. This is good.

What it doesn't know is how to properly place items contained by the fragment, which need to have their nodeIndices offset by their real parent.

The initial render of the fragments works fine because it's just inserting the entire markup of the fragment at a certain index, and incrementing the offset by the amount contained in the fragment. Further inserts break because it's not using this index.

The nodeIndices can be stored relative to the fragment, but we need to be able to add the nodeIndex of the parent.

And, of course, getting the nodeIndex of the parent isn't just a this away inside createChild - the parent doesn't contain the nodeIndex; its owner does. I don't think I can just safely access this._currentElement._owner._nodeIndex. Blargh.

@thomasboyt
Copy link
Owner Author

Should be noted that it should only do a parent nodeIndex lookup if it's a fragment; otherwise it should just use 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant