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

Eagerly initialize an mutable object for instance.refs #25696

Merged
merged 1 commit into from
Nov 16, 2022

Commits on Nov 16, 2022

  1. Eagerly initialize an mutable object for instance.refs

    This micro-optimization never made sense and less so now that they're rare.
    
    This still initializes the class with a shared immutable object in the
    constructor - which is also what createClass() does.
    
    Then we override it during mount. This is done in case someone messes up
    the initialization of the super() constructor for example, which was
    more common in polyfills.
    
    This change means that if a ref is initialized during the constructor
    itself it wouldn't be lazily initialized but that's not user code that
    does it, it's React so that shouldn't happen.
    sebmarkbage committed Nov 16, 2022
    Configuration menu
    Copy the full SHA
    2976957 View commit details
    Browse the repository at this point in the history