<commit_before>import 'babel-polyfill';
import Promise              from 'bluebird';
import moment               from 'moment';
import {
  mainStory,
  addListener,
}                           from 'storyboard';
import wsClient             from 'storyboard/lib/listeners/wsClient';
import browserExtension     from 'storyboard/lib/listeners/browserExtension';
import React                from 'react';
import ReactDOM             from 'react-dom';
import Relay                from 'react-relay';
import IsomorphicRelay      from 'isomorphic-relay';
import App                  from './components/010-app';
import { ViewerQuery }      from './gral/rootQueries';
import _t                   from '../translate';

if (process.env.NODE_ENV === 'production') {
  addListener(wsClient);
  addListener(browserExtension);
} else {
  Promise.longStackTraces();
}

mainStory.info('startup', 'Launching...');

// Process bootstrap: set up language and delete prerendered styles
_t.setLocales(window.AppBootstrap.locales);
moment.locale(window.AppBootstrap.lang);
const preRenderedStyles = document.getElementById('preRenderedStyles');
if (preRenderedStyles) {
  document.getElementsByTagName('head')[0].removeChild(preRenderedStyles);
}

const rootElement = document.getElementById('app');

if (window.AppBootstrap.relayData) {
  const environment = Relay.Store;

  // Comment out the following line if you find issues with the way the
  // client-side Relay store is initialised (esp. wrt. mutations doing erratic things)
  // IsomorphicRelay.injectPreparedData(environment, window.AppBootstrap.relayData);

  const rootContainerProps = {
    Container: App,
    queryConfig: new ViewerQuery(),
  };
  IsomorphicRelay.prepareInitialRender({ ...rootContainerProps, environment })
  .then(props => {
    ReactDOM.render(<IsomorphicRelay.Renderer {...props} />, rootElement);
  });
} else {
  ReactDOM.render(
    <Relay.RootContainer
      Component={App}
      route={new ViewerQuery()}
    />,
    rootElement
  );
}<commit_msg>Hydrate bootstrapped data (from SSR)<commit_after>import 'babel-polyfill';
import Promise              from 'bluebird';
import moment               from 'moment';
import {
  mainStory,
  addListener,
}                           from 'storyboard';
import wsClient             from 'storyboard/lib/listeners/wsClient';
import browserExtension     from 'storyboard/lib/listeners/browserExtension';
import React                from 'react';
import ReactDOM             from 'react-dom';
import Relay                from 'react-relay';
import IsomorphicRelay      from 'isomorphic-relay';
import App                  from './components/010-app';
import { ViewerQuery }      from './gral/rootQueries';
import _t                   from '../translate';

if (process.env.NODE_ENV === 'production') {
  addListener(wsClient);
  addListener(browserExtension);
} else {
  Promise.longStackTraces();
}

mainStory.info('startup', 'Launching...');

// Process bootstrap: set up language and delete prerendered styles
_t.setLocales(window.AppBootstrap.locales);
moment.locale(window.AppBootstrap.lang);
const preRenderedStyles = document.getElementById('preRenderedStyles');
if (preRenderedStyles) {
  document.getElementsByTagName('head')[0].removeChild(preRenderedStyles);
}

const rootElement = document.getElementById('app');

if (window.AppBootstrap.relayData) {
  const environment = Relay.Store;

  // Comment out the following line if you find issues with the way the
  // client-side Relay store is initialised (esp. wrt. mutations doing erratic things)
  IsomorphicRelay.injectPreparedData(environment, window.AppBootstrap.relayData);

  const rootContainerProps = {
    Container: App,
    queryConfig: new ViewerQuery(),
  };
  IsomorphicRelay.prepareInitialRender({ ...rootContainerProps, environment })
  .then(props => {
    ReactDOM.render(<IsomorphicRelay.Renderer {...props} />, rootElement);
  });
} else {
  ReactDOM.render(
    <Relay.RootContainer
      Component={App}
      route={new ViewerQuery()}
    />,
    rootElement
  );
}
{'fraction_non_alphanumeric': 0.11538461538461539, 'fraction_numerical': 0.0019723865877712033, 'mean_word_length': 3.3623655913978494, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '6848773', 'n_tokens_mistral': 1159, 'n_tokens_neox': 1132, 'n_words': 268}