[Slider] onChange
being called when value is not changing
#36614
Labels
bug 🐛
Something doesn't work
component: slider
This is the name of the generic UI component, not the React module!
Duplicates
Latest version
Steps to reproduce 🕹
Link to live example:
https://codesandbox.io/s/mui-slider-excessive-onchange-dudwxj?file=/demo.tsx
(^ forked from Discrete Sliders demo)
Steps:
onChange
handler has fired and console.log'd the existing value without a change to valueCurrent behavior 😯
onChange
fires when the slider thumb is clicked, but not moved.Expected behavior 🤔
Per #34448: [Slider] Only call onChange if the value changed.
Perhaps these tests are not effective:
material-ui/packages/mui-material/src/Slider/Slider.test.js
Lines 172 to 198 in b6b9314
Context 🔦
Excessive
onChange
invocations can degrade the performance of an application if downstream effects are expensive to compute.Your environment 🌎
No response
The text was updated successfully, but these errors were encountered: