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

Flush useEffect clean up functions in the passive effects phase #17925

Merged

Commits on Feb 3, 2020

  1. Flush useEffect clean up functions in the passive effects phase

    This is a change in behavior that may cause broken product code, so it has been added behind a killswitch (deferPassiveEffectCleanupDuringUnmount)
    Brian Vaughn committed Feb 3, 2020
    Copy the full SHA
    e1f8379 View commit details
    Browse the repository at this point in the history
  2. Avoid scheduling unnecessary callbacks for cleanup effects

    Updated enqueuePendingPassiveEffectDestroyFn() to check rootDoesHavePassiveEffects before scheduling a new callback. This way we'll only schedule (at most) one.
    Brian Vaughn committed Feb 3, 2020
    Copy the full SHA
    cf44b09 View commit details
    Browse the repository at this point in the history
  3. Updated newly added test for added clarity.

    Brian Vaughn committed Feb 3, 2020
    Copy the full SHA
    5f3a3b9 View commit details
    Browse the repository at this point in the history
  4. Cleaned up hooks effect tags

    We previously used separate Mount* and Unmount* tags to track hooks work for each phase (snapshot, mutation, layout, and passive). This was somewhat complicated to trace through and there were man tag types we never even used (e.g. UnmountLayout, MountMutation, UnmountSnapshot). In addition to this, it left passive and layout hooks looking the same after renders without changed dependencies, which meant we were unable to reliably defer passive effect destroy functions until after the commit phase.
    
    This commit reduces the effect tag types to only include Layout and Passive and differentiates between work and no-work with an HasEffect flag.
    Brian Vaughn committed Feb 3, 2020
    Copy the full SHA
    e8c7da1 View commit details
    Browse the repository at this point in the history
  5. Copy the full SHA
    d93a76f View commit details
    Browse the repository at this point in the history
  6. Split up unmount and mount effects list traversal

    Brian Vaughn committed Feb 3, 2020
    Copy the full SHA
    606af56 View commit details
    Browse the repository at this point in the history