<commit_before>import React       from 'react';
import { connect } from 'react-redux';
import classNames  from 'classnames';

import { openModal } from '../actions';

const mapStateToProps = state => {
  return {
    orders: state.orders
  };
};

const mapDispatchToProps = dispatch => {
  return {
    onCancelOrder(order) {
      dispatch(openModal('cancel', order));
    }
  };
};

class PendingOrders extends React.Component {
  propTypes = {
    orders       : React.PropTypes.orders,
    onCancelOrder: React.PropTypes.func
  };

  startTimer(order) {
    if (order.status === 'ready') {
      const orders = window.hz('orders');

      setTimeout(function(){orders.update({
        id     : order.id,
        removed: true
      })}, 500);

      return;
    }

    // Cancel also to avoid double event click/touch
    this.stopTimer();
    console.log('START');

    this.timeout = setTimeout(() => {
      console.log('GO');
      this.props.onCancelOrder(order);
    }, 750);
  }

  stopTimer() {
    console.log('CLEAR');
    clearTimeout(this.timeout);
  }

  render() {<commit_msg>Modify: delay set to 250 ms instead of 750<commit_after>import React       from 'react';
import { connect } from 'react-redux';
import classNames  from 'classnames';

import { openModal } from '../actions';

const mapStateToProps = state => {
  return {
    orders: state.orders
  };
};

const mapDispatchToProps = dispatch => {
  return {
    onCancelOrder(order) {
      dispatch(openModal('cancel', order));
    }
  };
};

class PendingOrders extends React.Component {
  propTypes = {
    orders       : React.PropTypes.orders,
    onCancelOrder: React.PropTypes.func
  };

  startTimer(order) {
    if (order.status === 'ready') {
      const orders = window.hz('orders');

      setTimeout(function(){orders.update({
        id     : order.id,
        removed: true
      })}, 250);

      return;
    }

    // Cancel also to avoid double event click/touch
    this.stopTimer();
    console.log('START');

    this.timeout = setTimeout(() => {
      console.log('GO');
      this.props.onCancelOrder(order);
    }, 750);
  }

  stopTimer() {
    console.log('CLEAR');
    clearTimeout(this.timeout);
  }

  render() {
{'fraction_non_alphanumeric': 0.14479025710419485, 'fraction_numerical': 0.008119079837618403, 'mean_word_length': 2.6782752902155886, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '647212', 'n_tokens_mistral': 703, 'n_tokens_neox': 676, 'n_words': 148}