<commit_before>import './todo-app.scss';

import React from 'react/addons';

import AppActions from '../../../js/actions/app-actions';
import TodoStore from '../../../js/stores/todo-store';

import Header from '../../molecules/header/header.jsx';
import TodoList from '../../organisms/todo-list/todo-list.jsx';

const TodoApp = React.createClass({
  getInitialState: function() {
    return ({ todos: TodoStore.getAll() });
  },

  componentDidMount: function() {
    TodoStore.addChangeListener(this._onChange);

    // fetch the initial list of todos from the server
    AppActions.getTodos();
  },

  _onChange: function() {
    this.setState({ todos: TodoStore.getAll() });
  },

  render: function() {
    return (
      <div className="todoApp">
        <Header />
        <div className="main">
          <TodoList todos={this.state.todos} />
        </div>
      </div>
    );
  }
});<commit_msg>Remove TodoApp TodoStore listener on unmount<commit_after>import './todo-app.scss';

import React from 'react/addons';

import AppActions from '../../../js/actions/app-actions';
import TodoStore from '../../../js/stores/todo-store';

import Header from '../../molecules/header/header.jsx';
import TodoList from '../../organisms/todo-list/todo-list.jsx';

const TodoApp = React.createClass({
  getInitialState: function() {
    return ({ todos: TodoStore.getAll() });
  },

  componentDidMount: function() {
    TodoStore.addChangeListener(this._onChange);

    // fetch the initial list of todos from the server
    AppActions.getTodos();
  },

  componentWillUnmount: function() {
    TodoStore.removeChangeListener(this._onChange);
  },

  _onChange: function() {
    this.setState({ todos: TodoStore.getAll() });
  },

  render: function() {
    return (
      <div className="todoApp">
        <Header />
        <div className="main">
          <TodoList todos={this.state.todos} />
        </div>
      </div>
    );
  }
});
{'fraction_non_alphanumeric': 0.17114788004136505, 'fraction_numerical': 0.0, 'mean_word_length': 2.87, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '5099318', 'n_tokens_mistral': 622, 'n_tokens_neox': 616, 'n_words': 128}