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

DevTools should iterate over siblings during mount #21377

Merged

Commits on Apr 28, 2021

  1. DevTools should iterate over siblings during mount

    Previously, DevTools recursed over children and siblings during mount. This caused potential stack overflows when there were a lot of children (e.g. a list containing many items).
    
    Given the following example component tree:
           A
        B  C  D
        E     F
              G
    
    A method that recurses for every child _and_ sibling leads to a max depth of 6:
        A
        A -> B
        A -> B -> E
        A -> B -> C
        A -> B -> C -> D
        A -> B -> C -> D -> F
        A -> B -> C -> D -> F -> G
    
    The stack gets deeper as the tree gets deepers or wider.
    
    A method that recurses for every child and iterates over siblings leads to a max depth of 4:
        A
        A -> B
        A -> B -> E
        A -> C
        A -> D
        A -> D -> F
        A -> D -> F -> G
    The stack gets deeper as the tree gets deepers, but is resiliant to wide trees (e.g. lists containing many items).
    Brian Vaughn committed Apr 28, 2021
    Configuration menu
    Copy the full SHA
    dbfab82 View commit details
    Browse the repository at this point in the history