Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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/
- Loading branch information