Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: facebook/react
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c8d9b8878a3a50fe94db5407727a3d5cba13f971
Choose a base ref
...
head repository: facebook/react
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 31f75cd4a0579c0be93b71ffc48ce0b308dad334
Choose a head ref
  • 9 commits
  • 2 files changed
  • 2 contributors

Commits on Aug 11, 2020

  1. [eslint-plugin-react-cooks] Report constant constructions

    The dependency array passed to a React hook can be thought of as a list of cache keys. On each render, if any dependency is not `===` its previous value, the hook will be rerun. Constructing a new object/array/function/etc directly within your render function means that the value will be referentially unique on each render. If you then use that value as a hook dependency, that hook will get a "cache miss" on every render, making the dependency array useless.
    
    This can be especially dangerous since it can cascade. If a hook such as `useMemo` is rerun on each render, not only are we bypassing the option to avoid potentially expensive work, but the value _returned_ by `useMemo` may end up being referentially unique on each render causing other downstream hooks or memoized components to become deoptimized.
    captbaritone committed Aug 11, 2020
    Configuration menu
    Copy the full SHA
    bc36370 View commit details
    Browse the repository at this point in the history

Commits on Aug 12, 2020

  1. Configuration menu
    Copy the full SHA
    450cdfd View commit details
    Browse the repository at this point in the history
  2. Don't give an autofix of wrapping object declarations

    It may not be safe to just wrap the declaration of an object, since the object may get mutated.
    
    Only offer this autofix for functions which are unlikely to get mutated.
    
    Also, update the message to clarify that the entire construction of the value should get wrapped.
    captbaritone committed Aug 12, 2020
    Configuration menu
    Copy the full SHA
    75fcb35 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4b6e20e View commit details
    Browse the repository at this point in the history

Commits on Aug 13, 2020

  1. Configuration menu
    Copy the full SHA
    e0ca072 View commit details
    Browse the repository at this point in the history
  2. Trim trailing whitespace

    captbaritone committed Aug 13, 2020
    Configuration menu
    Copy the full SHA
    4dc35db View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    eaa2aff View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    2b7ae4b View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    31f75cd View commit details
    Browse the repository at this point in the history
Loading