<commit_before>/** @jsx React.DOM */

define([
  "React"
], function(React) {
  return React.createClass({
    destroy: function(event) {
      if (event.target.className === "modal" ||
          event.target.className === "modal-dialog") {
        var domNode = this.getDOMNode();
        React.unmountComponentAtNode(domNode);

        $(domNode).remove();
      }
    },
    render: function() {
      return (
        <div>
          <div className="modal" onClick={this.destroy}>
            <div className="modal-dialog">
              <div className="modal-content">
                <div className="modal-body">
                  {this.props.children}
                </div>
              </div>
            </div>
          </div>
          <div className="modal-backdrop fade in"></div>
        </div>
      );
    }
  });
});<commit_msg>Clean up destroyed modal properly<commit_after>/** @jsx React.DOM */

define([
  "jquery",
  "React"
], function($, React) {
  return React.createClass({
    destroy: function(event) {
      if (event.target.className === "modal" ||
          event.target.className === "modal-dialog") {
        var domNode = this.getDOMNode();

        // TODO(ssorallen): Why does this need to unmount from the parentNode?
        // If it is unmounted from `domNode`, the second render throws an
        // invariant exception.
        React.unmountComponentAtNode(domNode.parentNode);

        $(domNode).remove();
      }
    },
    render: function() {
      return (
        <div>
          <div className="modal" onClick={this.destroy}>
            <div className="modal-dialog">
              <div className="modal-content">
                {this.props.children}
              </div>
            </div>
          </div>
          <div className="modal-backdrop fade in"></div>
        </div>
      );
    }
  });
});
{'fraction_non_alphanumeric': 0.15247844827586207, 'fraction_numerical': 0.0, 'mean_word_length': 1.82648401826484, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '414139', 'n_tokens_mistral': 523, 'n_tokens_neox': 521, 'n_words': 112}