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

Refactor how composite type changes work, fix memory leak in ReactMount caching #4983

Merged
merged 5 commits into from
Oct 7, 2015

Commits on Oct 7, 2015

  1. Don't use existing "root" ID if non-root

    Before, if you had
    
    ```
    container = <div data-reactid=".0"><div data-reactid=".0.0" /></div>;
    ```
    
    and did `ReactDOM.render(<span />, container)` you would get
    
    ```
    <div data-reactid=".0"><span data-reactid=".0" /></div>;
    ```
    
    (along with a warning not to replace React-rendered children with a new tree like that). But that makes no sense -- the span should have a new index, not truncate the ID of the old child it's replacing.
    
    (Now tests pass again with useCreateElement on; before they threw a "valid but unequal" on our test for this warning.)
    sophiebits committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    e4a4338 View commit details
    Browse the repository at this point in the history
  2. Cache native node on native components, return it when unmounting

    This is probably slightly slower for unmounts in the case that no updates were ever performed, but caching the node on the instance should make updates faster. In any case, the more important consequence of this change is that we can fix the current memory leak that happens when swapping composite types.
    sophiebits committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    743ccf0 View commit details
    Browse the repository at this point in the history
  3. Use returned native node for composite type-change

    With this change, all unmounted components should be properly purged from ReactMount's cache.
    sophiebits committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    60491d8 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    fe9a76e View commit details
    Browse the repository at this point in the history
  5. ReactMount now never expects invalid nodes in its cache

    It never really made sense for us to have "invalid" nodes in the cache -- when we unmount things, we should always remove them from the cache properly. Now that swapping composite types doesn't repopulate the cache, we should be okay to now assume that everything in the cache is good.
    sophiebits committed Oct 7, 2015
    Configuration menu
    Copy the full SHA
    8ce7b71 View commit details
    Browse the repository at this point in the history