thomasboyt / react

React is a JavaScript library for building user interfaces. It's declarative, efficient, and extremely flexible. What's more, it works with the libraries and frameworks that you already know.
http://facebook.github.io/react/
Other
0 stars 1 forks source link

Investigate a better node-counting solution #6

Closed thomasboyt closed 9 years ago

thomasboyt commented 9 years ago

The core issue with ReactDOMFragment is that is the rendered component of a ReactCompositeComponent. It is, as best I can tell, impossible to access composite component from the DOM fragment, meaning it's impossible to update the nodeCount of the composite component.

This leads to the following issues:

  1. If the number of children in a fragment change, the fragment's composite component nodeCount is not updated
  2. The composite component cannot simply access the renderedComponent's nodeCount because the rendered component is removed during the removal cycle, before removeChild is called

Possible better ways to store node counts:

thomasboyt commented 9 years ago

The thing I keep coming back to is problem 2 above. It seems like such a fixable thing, and using a map to get around it seems like such a massive hammer to apply to a tiny problem.

thomasboyt commented 9 years ago

Managed to work around point 2 for now by storing on the CompositeComponent