<commit_before>import React, {PropTypes} from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import * as customerActions from '../actions/customerActions';
import CustomerForm from './CustomerForm';
import toastr from 'toastr';

class ManageCustomer extends React.Component {
  constructor(props, context) {
    super(props, context);
    this.state = {
      customer: Object.assign({}, props.customer),
      errors: {},
      saving: false
    };
    this.change = this.change.bind(this);
    this.save = this.save.bind(this);
  }

  componentWillReceiveProps(nextProps) {
    if (this.props.customer.id != nextProps.customer.id) {
      this.setState({customer: Object.assign({}, nextProps.customer)});
    }
  }

  save(event) {
    event.preventDefault();
    this.setState({saving: true});
    this.props.actions.saveCustomer(this.state.customer)
      .then(() => {
        var self = this;
        setTimeout(function() {
          self.setState({saving: false});
          toastr.success("Customer saved");
          self.context.router.push('/');
        }, 2000);
      });
  }

  change(event) {
    const field = event.target.name;
    let customer = this.state.customer;
    customer[field] = event.target.value;
    return this.setState({customer: customer});
  };

  render() {<commit_msg>remove lag simulation<commit_after>import React, {PropTypes} from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import * as customerActions from '../actions/customerActions';
import CustomerForm from './CustomerForm';
import toastr from 'toastr';

class ManageCustomer extends React.Component {
  constructor(props, context) {
    super(props, context);
    this.state = {
      customer: Object.assign({}, props.customer),
      errors: {},
      saving: false
    };
    this.change = this.change.bind(this);
    this.save = this.save.bind(this);
  }

  componentWillReceiveProps(nextProps) {
    if (this.props.customer.id != nextProps.customer.id) {
      this.setState({customer: Object.assign({}, nextProps.customer)});
    }
  }

  save(event) {
    event.preventDefault();
    this.setState({saving: true});
    this.props.actions.saveCustomer(this.state.customer)
      .then(() => {
        this.setState({saving: false});
        toastr.success("Customer saved");
        this.context.router.push('/');
      });
  }

  change(event) {
    const field = event.target.name;
    let customer = this.state.customer;
    customer[field] = event.target.value;
    return this.setState({customer: customer});
  };

  render() {
{'fraction_non_alphanumeric': 0.15032430370087752, 'fraction_numerical': 0.0015261350629530714, 'mean_word_length': 3.2773246329526917, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1446565', 'n_tokens_mistral': 776, 'n_tokens_neox': 772, 'n_words': 159}