<commit_before>import React, { Component, PropTypes } from 'react';
import Const from '../Const';

class TextFilter extends Component {
  constructor(props) {
    super(props);
    this.filter = this.filter.bind(this);
    this.timeout = null;
  }

  filter(event) {
    if (this.timeout) {
      clearTimeout(this.timeout);
    }
    const filterValue = event.target.value;
    this.timeout = setTimeout(() => {
      this.props.filterHandler(filterValue, Const.FILTER_TYPE.TEXT);
    }, this.props.delay);
  }

  componentDidMount() {
    const defaultValue = this.refs.inputText.defaultValue;
    if (defaultValue) {
      this.props.filterHandler(defaultValue, Const.FILTER_TYPE.TEXT);
    }
  }

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

  render() {
    const { placeholder, columnName, defaultValue } = this.props;
    return (
      <input ref='inputText'
        className='filter text-filter form-control'
        type='text'
        onChange={ this.filter }
        placeholder={ placeholder || `Enter ${columnName}...` }<commit_msg>defaultValue is always an empty string, value is the correct one<commit_after>import React, { Component, PropTypes } from 'react';
import Const from '../Const';

class TextFilter extends Component {
  constructor(props) {
    super(props);
    this.filter = this.filter.bind(this);
    this.timeout = null;
  }

  filter(event) {
    if (this.timeout) {
      clearTimeout(this.timeout);
    }
    const filterValue = event.target.value;
    this.timeout = setTimeout(() => {
      this.props.filterHandler(filterValue, Const.FILTER_TYPE.TEXT);
    }, this.props.delay);
  }

  componentDidMount() {
    const defaultValue = this.refs.inputText.value;
    if (defaultValue) {
      this.props.filterHandler(defaultValue, Const.FILTER_TYPE.TEXT);
    }
  }

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

  render() {
    const { placeholder, columnName, defaultValue } = this.props;
    return (
      <input ref='inputText'
        className='filter text-filter form-control'
        type='text'
        onChange={ this.filter }
        placeholder={ placeholder || `Enter ${columnName}...` }
{'fraction_non_alphanumeric': 0.13097426470588236, 'fraction_numerical': 0.0, 'mean_word_length': 3.11531190926276, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6845128', 'n_tokens_mistral': 638, 'n_tokens_neox': 633, 'n_words': 132}