<commit_before>var async = require("async");
var React = require("react");
var Router = require("react-router");
var routes = require("../app/" + __resourceQuery.substr(1) + "Routes");
var stores = require("../app/" + __resourceQuery.substr(1) + "Stores");
var withTimeout = require("./withTimeout");

var initialRun = true;

// react-router handles location
Router.run(routes, Router.HistoryLocation, function(Application, state) {

	// On every page navigation invalidate data from the stores
	// This is not needed when the server notifies the client about changes (WebSocket, SSE)
	if(!initialRun) {
		Object.keys(stores).forEach(function(key) {
			stores[key].outdate();
		});
	}
	initialRun = false;

	stores.Router.setItemData("transition", state);

	// try to fetch data for a defined timespan
	// when the data is not fully fetched after the timeout components are rendered (with missing/old data)
	withTimeout(async.forEach.bind(async, state.routes, function(route, callback) {
		if(route.handler.chargeStores) {
			route.handler.chargeStores(stores, state.params, callback);
		} else {
			callback();
		}
	}), 600, function() {

		stores.Router.setItemData("transition", null);

		// Render the components with the stores
		React.withContext({
			stores: stores
		}, function() {
			React.render(<Application />, document.getElementById("content"));
		});
	});
});
<commit_msg>batch more updates<commit_after>var async = require("async");
var React = require("react");
var Router = require("react-router");
var routes = require("../app/" + __resourceQuery.substr(1) + "Routes");
var stores = require("../app/" + __resourceQuery.substr(1) + "Stores");
var withTimeout = require("./withTimeout");
var ReactUpdates = require("react/lib/ReactUpdates");

var initialRun = true;

// react-router handles location
Router.run(routes, Router.HistoryLocation, function(Application, state) {

	// On every page navigation invalidate data from the stores
	// This is not needed when the server notifies the client about changes (WebSocket, SSE)
	if(!initialRun) {
		Object.keys(stores).forEach(function(key) {
			stores[key].outdate();
		});
	}
	initialRun = false;

	ReactUpdates.batchedUpdates(function() {
		stores.Router.setItemData("transition", state);
	});

	// try to fetch data for a defined timespan
	// when the data is not fully fetched after the timeout components are rendered (with missing/old data)
	withTimeout(async.forEach.bind(async, state.routes, function(route, callback) {
		if(route.handler.chargeStores) {
			route.handler.chargeStores(stores, state.params, callback);
		} else {
			callback();
		}
	}), 600, function() {

		ReactUpdates.batchedUpdates(function() {
			stores.Router.setItemData("transition", null);
		});

		// Render the components with the stores
		React.withContext({
			stores: stores
		}, function() {
			React.render(<Application />, document.getElementById("content"));
		});
	});
});

{'fraction_non_alphanumeric': 0.1459256733719741, 'fraction_numerical': 0.0034094783498124785, 'mean_word_length': 4.609942638623327, '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': '6835860', 'n_tokens_mistral': 929, 'n_tokens_neox': 873, 'n_words': 231}