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

Fix useScrollIntoView ignoring parameter changes #2866

Merged
merged 3 commits into from Nov 6, 2022

Commits on Nov 2, 2022

  1. Fix useScrollIntoView ignoring parameter changes

    Currently, useScrollIntoView returns a memoized callback that always
    refers to the params passed during the first render of the calling
    component, so calling with dynamically computed params, e.g.
    useScrollIntoView({ offset: someVariable }) will memoize the offset
    passed during the first render. If the component re-renders, any new
    offset passed is ignored.
    
    Aditionally, 'scrollableRef.current' is an invalid dependency, see
    https://epicreact.dev/why-you-shouldnt-put-refs-in-a-dependency-array/
    rChaoz committed Nov 2, 2022
    Copy the full SHA
    8731560 View commit details
    Browse the repository at this point in the history
  2. Replace tab with 4 spaces

    rChaoz committed Nov 2, 2022
    Copy the full SHA
    80e72a0 View commit details
    Browse the repository at this point in the history
  3. Remove ref dependency

    rChaoz committed Nov 2, 2022
    Copy the full SHA
    c2ef433 View commit details
    Browse the repository at this point in the history