<commit_before>import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { CSSTransitionGroup } from 'react-transition-group';


import './style.scss';
//<span onLoad={this.blinkAnimation()} className="glyphicon glyphicon-dot-sm glyphicon-recording-status Blink" aria-hidden="true" />

class Blinker extends Component {
  static propTypes = {
    dataPing: PropTypes.bool
  };

  constructor(props) {
    super(props);
    this.state = { blink: "meow" };
  }

  componentDidUpdate(prevProps, prevState) {
    if(this.props.dataPing && !prevProps.dataPing) {
      this.setState({ blinking: true });
      // clear blink timeout if another request comes in before previous blink is done
      clearTimeout(this.blinkHandle);
      // blink anywhere from 500ms - 1.5s
      this.blinkHandle = setTimeout(() => this.setState({ blink: false }), (Math.random() * 1000) + 500);
    }
  }

  componentWillUnmount() {
    // make sure timer is cleared before unmounting
    clearTimeout(this.blinkHandle);
  }

  render() {
    return (
      <span className={classNames({ blink: this.state.blink }, "glyphicon glyphicon-dot-sm glyphicon-recording-status")} aria-hidden="true" />
    );
  }
}


export default Blinker;<commit_msg>fixes blink state<commit_after>import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { CSSTransitionGroup } from 'react-transition-group';


import './style.scss';

class Blinker extends Component {
  static propTypes = {
    dataPing: PropTypes.bool
  };

  constructor(props) {
    super(props);
    this.state = { blink: true };
  }

  componentDidUpdate(prevProps, prevState) {
    if(this.props.dataPing && !prevProps.dataPing) {
      this.setState({ blinking: true });
      clearTimeout(this.blinkHandle);
      this.blinkHandle = setTimeout(() => this.setState({ blink: false }), (Math.random() * 1000) + 500);
    }
  }

  componentWillUnmount() {
    clearTimeout(this.blinkHandle);
  }

  render() {
    return (
      <span className={classNames({ blink: this.state.blink }, "glyphicon glyphicon-dot-sm glyphicon-recording-status")} aria-hidden="true" />
    );
  }
}


export default Blinker;
{'fraction_non_alphanumeric': 0.13716814159292035, 'fraction_numerical': 0.008407079646017699, 'mean_word_length': 3.681159420289855, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, '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': '6600256', 'n_tokens_mistral': 727, 'n_tokens_neox': 693, 'n_words': 159}