<commit_before>'use strict';

import React from 'react';
import PropTypes from 'prop-types'
import Symbol from './RatingSymbol';

class Rating extends React.PureComponent {
  constructor(props) {
    super(props);
    this.state = {
      //Indicates the value that is displayed to the user in the form of symbols
      // always starts at the minimum possible value (step / fractions)
      // always ends at (stop - start)
      displayValue: this.props.establishedValue,
      //Indicates if the user is currently hovering over the rating element
      interacting: false,
      //Indicates if the rating element has been clicked even once
      dirty: false
    };
    this.onClick = this.onClick.bind(this);
    this.onMouseEnter = this.onMouseEnter.bind(this);
    this.onMouseMove = this.onMouseMove.bind(this);
    this.onMouseLeave = this.onMouseLeave.bind(this);
  }

  componentWillReceiveProps(nextProps) {
    this.setState({
      dirty: this.state.dirty || true,
      displayValue: nextProps.establishedValue
    });
  }
<commit_msg>Change dirty only if the prop that changed was the establishedValue<commit_after>'use strict';

import React from 'react';
import PropTypes from 'prop-types'
import Symbol from './RatingSymbol';

class Rating extends React.PureComponent {
  constructor(props) {
    super(props);
    this.state = {
      //Indicates the value that is displayed to the user in the form of symbols
      // always starts at the minimum possible value (step / fractions)
      // always ends at (stop - start)
      displayValue: this.props.establishedValue,
      //Indicates if the user is currently hovering over the rating element
      interacting: false,
      //Indicates if the rating element has been clicked even once
      dirty: false
    };
    this.onClick = this.onClick.bind(this);
    this.onMouseEnter = this.onMouseEnter.bind(this);
    this.onMouseMove = this.onMouseMove.bind(this);
    this.onMouseLeave = this.onMouseLeave.bind(this);
  }

  componentWillReceiveProps(nextProps) {
    this.setState({
      dirty: ((this.props.establishedValue !== nextProps.establishedValue) && !this.state.dirty) ? true : false,
      displayValue: nextProps.establishedValue
    });
  }

{'fraction_non_alphanumeric': 0.09568733153638814, 'fraction_numerical': 0.0, 'mean_word_length': 3.2662835249042144, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1301719', 'n_tokens_mistral': 625, 'n_tokens_neox': 604, 'n_words': 195}