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

RFC 6: Deprecate unsafe lifecycles #12028

Merged
merged 28 commits into from
Jan 19, 2018
Merged

RFC 6: Deprecate unsafe lifecycles #12028

merged 28 commits into from
Jan 19, 2018

Commits on Jan 16, 2018

  1. Added unsafe_* lifecycles and deprecation warnings

    If the old lifecycle hooks (componentWillMount, componentWillUpdate, componentWillReceiveProps) are detected, these methods will be called and a deprecation warning will be logged. (In other words, we do not check for both the presence of the old and new lifecycles.) This commit is expected to fail tests.
    bvaughn committed Jan 16, 2018
    Configuration menu
    Copy the full SHA
    e709e30 View commit details
    Browse the repository at this point in the history
  2. Ran lifecycle hook codemod over project

    This should handle the bulk of the updates. I will manually update TypeScript and CoffeeScript tests with another commit.
    The actual command run with this commit was: jscodeshift --parser=flow -t ../react-codemod/transforms/rename-unsafe-lifecycles.js ./packages/**/src/**/*.js
    bvaughn committed Jan 16, 2018
    Configuration menu
    Copy the full SHA
    404944e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    bd300b3 View commit details
    Browse the repository at this point in the history
  4. Added inline note to createReactClassIntegration-test

    Explaining why lifecycles hooks have not been renamed in this test.
    bvaughn committed Jan 16, 2018
    Configuration menu
    Copy the full SHA
    2868176 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    8679926 View commit details
    Browse the repository at this point in the history

Commits on Jan 17, 2018

  1. Added static getDerivedStateFromProps to ReactPartialRenderer

    Also added a new set of tests focused on server side lifecycle hooks.
    bvaughn committed Jan 17, 2018
    Configuration menu
    Copy the full SHA
    64f27d7 View commit details
    Browse the repository at this point in the history
  2. Added getDerivedStateFromProps to shallow renderer

    Also added warnings for several cases involving getDerivedStateFromProps() as well as the deprecated lifecycles.
    Also added tests for the above.
    bvaughn committed Jan 17, 2018
    Configuration menu
    Copy the full SHA
    1047182 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    035c220 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8d0e001 View commit details
    Browse the repository at this point in the history
  5. Added getDerivedStateFromProps to ReactFiberClassComponent

    Also updated class component and lifecyle tests to cover the added functionality.
    bvaughn committed Jan 17, 2018
    Configuration menu
    Copy the full SHA
    b71ca93 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    09c39d0 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    286df77 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    b699543 View commit details
    Browse the repository at this point in the history

Commits on Jan 18, 2018

  1. Configuration menu
    Copy the full SHA
    68f2fe7 View commit details
    Browse the repository at this point in the history
  2. Moved lifecycle deprecation warnings behind (disabled) feature flag

    Updated tests accordingly, by temporarily splitting tests that were specific to this feature-flag into their own, internal tests. This was the only way I knew of to interact with the feature flag without breaking our build/dist tests.
    bvaughn committed Jan 18, 2018
    Configuration menu
    Copy the full SHA
    2d9f75d View commit details
    Browse the repository at this point in the history
  3. Tidying up

    bvaughn committed Jan 18, 2018
    Configuration menu
    Copy the full SHA
    8f125b7 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1d3e3d5 View commit details
    Browse the repository at this point in the history
  5. Tweaked warning message wording slightly

    Replaced 'You may may have returned undefined.' with 'You may have returned undefined.'
    bvaughn committed Jan 18, 2018
    Configuration menu
    Copy the full SHA
    d95ec49 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    b940938 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    6cd0a8e View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    7572667 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    361a2cf View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    8178d52 View commit details
    Browse the repository at this point in the history
  11. Inject state as a param to callGetDerivedStateFromProps

    This value will be either workInProgress.memoizedState (for updates) or instance.state (for initialization).
    bvaughn committed Jan 18, 2018
    Configuration menu
    Copy the full SHA
    8d67e27 View commit details
    Browse the repository at this point in the history
  12. Explicitly warn about uninitialized state before calling getDerivedSt…

    …ateFromProps.
    
    And added some new tests for this change.
    
    Also:
    * Improved a couple of falsy null/undefined checks to more explicitly check for null or undefined.
    * Made some small tweaks to ReactFiberClassComponent WRT when and how it reads instance.state and sets to null.
    bvaughn committed Jan 18, 2018
    Configuration menu
    Copy the full SHA
    53770c3 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    3772ee2 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    4dfa6e1 View commit details
    Browse the repository at this point in the history

Commits on Jan 19, 2018

  1. Fix state-regression for module-pattern components

    Also add support for new static getDerivedStateFromProps method
    bvaughn committed Jan 19, 2018
    Configuration menu
    Copy the full SHA
    5609031 View commit details
    Browse the repository at this point in the history