You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good catch -- we're probably trying to be a little too clever here since by trying to avoid re-renders internally. That should probably be left to the user in this case. I've patched this up in a sandbox but am anticipating that you might have another problem unless you're trying to get the previous value in your event handler. Haven't merged anything yet because I need to test a few edge cases with these changes: https://codesandbox.io/s/intelligent-ives-0x6rz?file=/src/App.js
chaance
changed the title
[Slider] onMouseDown useCallback Function is Not Being Updated
[slider] onMouseDown function is not correctly updated
Apr 21, 2021
A note for self: this change will affect all pointer-related events, and we'll want to add notes in the documentation if users want to opt-in to the current behavior after the change.
🐛 Bug report
Current Behavior
Passing a
useCallback
function to theonMouseDown
prop (and the other similar props) keeps the original function around.Expected behavior
A
useCallback
function passed to theonMouseDown
prop (and other similar props) should be updated when something in the dependency array changes.Reproducible example
Sample of the issue in CodeSandbox
Your environment
@reach/slider
0.13.0
react
17.0.1
86.0
v14.13.1
1.21.1
10.15.7
The text was updated successfully, but these errors were encountered: