Skip to content

Commit

Permalink
Updated Slider to only call onChange and onDragChange when the value …
Browse files Browse the repository at this point in the history
…or distance has been updated
  • Loading branch information
mlaursen committed Jul 7, 2017
1 parent d4ea943 commit d588fb4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/js/Sliders/Slider.js
Expand Up @@ -604,11 +604,12 @@ export default class Slider extends PureComponent {
normalize
);

if (onChange) {
const isNewValue = getField(this.props, this.state, 'value') !== value;
if (onChange && isNewValue) {
onChange(value, e);
}

if (!normalize && onDragChange) {
if (!normalize && onDragChange && (isNewValue || this.state.distance !== distance)) {
onDragChange(distance, value, e);
}

Expand Down

0 comments on commit d588fb4

Please sign in to comment.