<commit_before>import React, {PropTypes, Component} from 'react';
import Slider from 'rc-slider';

// @TODO: rc-slider doesn't support our customization options relative to
// theming. We'll need to implement our own slider down the road.
export default class Range extends Component {
  static propTypes = {
    min: PropTypes.number.isRequired,
    max: PropTypes.number.isRequired,
    value: PropTypes.shape({
      min: PropTypes.number,
      max: PropTypes.number,
    }).isRequired,
    refine: PropTypes.func.isRequired,
  };

  constructor() {
    super();

    // rc-slider calls its `onChange` prop when the provided value is outside
    // its bounds. We don't care for the corrected value.
    this.ignoreNextOnChange = false;

    this.state = {
      controlled: false,
      value: null,
    };
  }

  componentWillReceiveProps() {
    this.ignoreNextOnChange = true;
  }

  componentDidUpdate() {
    this.ignoreNextOnChange = false;
  }

  onChange = value => {
    if (this.ignoreNextOnChange) {
      this.ignoreNextOnChange = false;
      return;
    }
    this.setState({
      controlled: true,
      value: {min: value[0], max: value[1]},
    });
  };

  onAfterChange = () => {
    this.props.refine(this.state.value);
    this.setState({<commit_msg>Fix Range refine when values hasn't changed<commit_after>import React, {PropTypes, Component} from 'react';
import Slider from 'rc-slider';

// @TODO: rc-slider doesn't support our customization options relative to
// theming. We'll need to implement our own slider down the road.
export default class Range extends Component {
  static propTypes = {
    min: PropTypes.number.isRequired,
    max: PropTypes.number.isRequired,
    value: PropTypes.shape({
      min: PropTypes.number,
      max: PropTypes.number,
    }).isRequired,
    refine: PropTypes.func.isRequired,
  };

  constructor() {
    super();

    // rc-slider calls its `onChange` prop when the provided value is outside
    // its bounds. We don't care for the corrected value.
    this.ignoreNextOnChange = false;

    this.state = {
      controlled: false,
      value: null,
    };
  }

  componentWillReceiveProps() {
    this.ignoreNextOnChange = true;
  }

  componentDidUpdate() {
    this.ignoreNextOnChange = false;
  }

  onChange = value => {
    if (this.ignoreNextOnChange) {
      this.ignoreNextOnChange = false;
      return;
    }
    this.setState({
      controlled: true,
      value: {min: value[0], max: value[1]},
    });
  };

  onAfterChange = value => {
    this.props.refine({min: value[0], max: value[1]});
    this.setState({
{'fraction_non_alphanumeric': 0.11696806464024626, 'fraction_numerical': 0.002308580223162755, 'mean_word_length': 2.9393939393939394, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5518131', 'n_tokens_mistral': 789, 'n_tokens_neox': 780, 'n_words': 217}