<commit_before>var React = require('react');
var Loader = require('./common/loader.js');
var ProjectUtils = require('../utils/ProjectUtils');
var ProjectStore = require('../stores/ProjectStore');
var Explorer = require('./explorer/index.js');

function getProjectState() {
  return {
    project: ProjectStore.getProject()
  };
}

var App = React.createClass({

	componentDidMount: function() {
    ProjectStore.addChangeListener(this._onChange);
    if (this.state.project) {
      ProjectUtils.fetchProjectSchema(this.state.project);
    }
	},

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

	getInitialState: function() {
		return getProjectState();
	},

  render: function () {
    return (
    	<div id="keen-explorer">
    		<Loader visible={this.state.project.loading} additionalClasses="app-loader" />
        <Explorer project={this.state.project}
                  client={this.props.client}
                  persistence={this.props.persistence} />
      </div>
    );
  },

  _onChange: function() {
    this.setState(getProjectState());
  }

});

module.exports = App;<commit_msg>Wait for persisted explorers to be loaded before removing app loader.<commit_after>var React = require('react');
var Loader = require('./common/loader.js');
var ProjectStore = require('../stores/ProjectStore');
var AppStateStore = require('../stores/AppStateStore');
var Explorer = require('./explorer/index.js');

function getProjectState() {
  return {
    project: ProjectStore.getProject(),
    app: AppStateStore.getState()
  };
}

var App = React.createClass({

	componentDidMount: function() {
    ProjectStore.addChangeListener(this._onChange);
    AppStateStore.addChangeListener(this._onChange);
	},

  componentWillUnmount: function() {
    ProjectStore.removeChangeListener(this._onChange);
    AppStateStore.addChangeListener(this._onChange);
  },

	getInitialState: function() {
		return getProjectState();
	},

  render: function () {
    return (
    	<div id="keen-explorer">
    		<Loader visible={this.state.project.loading || this.state.app.fetchingPersistedExplorers} additionalClasses="app-loader" />
        <Explorer project={this.state.project}
                  client={this.props.client}
                  persistence={this.props.persistence} />
      </div>
    );
  },

  _onChange: function() {
    this.setState(getProjectState());
  }

});

module.exports = App;
{'fraction_non_alphanumeric': 0.14561115668580804, 'fraction_numerical': 0.0, 'mean_word_length': 3.654580152671756, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '5192985', 'n_tokens_mistral': 730, 'n_tokens_neox': 708, 'n_words': 119}