<commit_before>/* React, browser and server rendering functions. We need the
 * first import, even though it isn't explicitly referenced
 * in this file, in order to avoid runtime errors. */
import React from 'react';
import { render } from 'react-dom';
import { renderToString } from 'react-dom/server';

/* State management with redux */
import createStore from './store';
import { Provider } from 'react-redux'

/* Routing with react-router */
import { Router, RouterContext, match } from 'react-router';
import { browserHistory } from 'react-router'

/* Link state to route with react-router-redux */
import { syncHistoryWithStore } from 'react-router-redux';

/* Our routing rules (actually a function that takes an auth and returns the rules) */
import buildRoutes from './routes';

if (typeof window !== 'undefined') {

  const store = createStore(window.__INITIAL_STATE__);

  const history = syncHistoryWithStore(browserHistory, store);

  let app = (
    <Provider store={store}>
      <Router history={history}>
        {buildRoutes(store)}
      </Router>
    </Provider>
  );

  render(app, document.getElementById('mount'));
}
else {
  // When running in Nashorn, the process object doesn't exist. Define it
  // so that when the React code tests for production mode, it succeeds.
  process = {
    env: {
      NODE_ENV: 'production'
    }
  };
}

export function renderApp(path, state) : string {
  const store = createStore(state);
  let renderResult = '';

  match({ routes: buildRoutes(store), location: path }, (error, redirectLocation, renderProps) => {
    if (renderProps) {<commit_msg>Move react-router-redux to a branch as I don't actually need it<commit_after>/* React, browser and server rendering functions. We need the
 * first import, even though it isn't explicitly referenced
 * in this file, in order to avoid runtime errors. */
import React from 'react';
import { render } from 'react-dom';
import { renderToString } from 'react-dom/server';

/* State management with redux */
import createStore from './store';
import { Provider } from 'react-redux'

/* Routing with react-router */
import { Router, RouterContext, match } from 'react-router';
import { browserHistory } from 'react-router'

/* Our routing rules (actually a function that takes an auth and returns the rules) */
import buildRoutes from './routes';

if (typeof window !== 'undefined') {

  const store = createStore(window.__INITIAL_STATE__);

  let app = (
    <Provider store={store}>
      <Router history={browserHistory}>
        {buildRoutes(store)}
      </Router>
    </Provider>
  );

  render(app, document.getElementById('mount'));
}
else {
  // When running in Nashorn, the process object doesn't exist. Define it
  // so that when the React code tests for production mode, it succeeds.
  process = {
    env: {
      NODE_ENV: 'production'
    }
  };
}

export function renderApp(path, state) : string {
  const store = createStore(state);
  let renderResult = '';

  match({ routes: buildRoutes(store), location: path }, (error, redirectLocation, renderProps) => {
    if (renderProps) {
{'fraction_non_alphanumeric': 0.11899387294421154, 'fraction_numerical': 0.0, 'mean_word_length': 3.8167701863354035, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '6680171', 'n_tokens_mistral': 873, 'n_tokens_neox': 850, 'n_words': 320}