<commit_before>import React, { PropTypes, Component } from 'react';
import { Modal, Button } from 'react-bootstrap';

class DeleteRestaurantModal extends Component {
  state = {};

  componentWillMount() {
    // set state in case restaurant is deleted and restaurant disappears
    this.setState({
      restaurantName: this.props.restaurant.name
    });
  }

  render() {
    return (
      <Modal show={this.props.shown} onHide={this.props.hideModal}>
        <Modal.Body>
          Are you sure you want to delete {this.state.restaurantName}?
        </Modal.Body>
        <Modal.Footer>
          <form onSubmit={this.props.deleteRestaurant}>
            <Button type="button" bsSize="small" onClick={this.props.hideModal}>Cancel</Button>
            <Button type="submit" autoFocus bsSize="small" bsStyle="primary">Delete</Button>
          </form>
        </Modal.Footer>
      </Modal><commit_msg>Set new state when model gets new restaurant name<commit_after>import React, { PropTypes, Component } from 'react';
import { Modal, Button } from 'react-bootstrap';

class DeleteRestaurantModal extends Component {
  state = {};

  componentWillMount() {
    // set state in case restaurant is deleted and restaurant disappears
    this.setState({
      restaurantName: this.props.restaurant.name
    });
  }

  componentWillReceiveProps(nextProps) {
    if (nextProps.restaurant.name !== undefined && nextProps.restaurant.name !== this.state.restaurantName) {
      this.setState({
        restaurantName: nextProps.restaurant.name
      });
    }
  }

  render() {
    return (
      <Modal show={this.props.shown} onHide={this.props.hideModal}>
        <Modal.Body>
          Are you sure you want to delete {this.state.restaurantName}?
        </Modal.Body>
        <Modal.Footer>
          <form onSubmit={this.props.deleteRestaurant}>
            <Button type="button" bsSize="small" onClick={this.props.hideModal}>Cancel</Button>
            <Button type="submit" autoFocus bsSize="small" bsStyle="primary">Delete</Button>
          </form>
        </Modal.Footer>
      </Modal>
{'fraction_non_alphanumeric': 0.1258373205741627, 'fraction_numerical': 0.0, 'mean_word_length': 2.960227272727273, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '5830295', 'n_tokens_mistral': 603, 'n_tokens_neox': 580, 'n_words': 136}