<commit_before>import React, {Component} from 'react'
import PropTypes from 'prop-types'
import {Provider} from 'react-redux'
import {ConnectedRouter as Router} from 'react-router-redux'

export default class Root extends Component {
  static propTypes = {
    store: PropTypes.object,
    history: PropTypes.object,
    routes: PropTypes.func
  }

  /**
     * Checks Auth logic. Is user allowed to visit certain path?
     * @param  {String} path next path to visit
     * @return {Bool} is user allowed to visit next location?
     * check RouteAuth component.
     */
  authCheck (path) {
    const {store} = this.props
    const {loggedIn} = store.getState().auth
    const authPath = '/auth'
    const allowedToVisitPath = [authPath]
    if (loggedIn && path === authPath) {
      return false
    } else if (!loggedIn && !allowedToVisitPath.includes(path)) {
      return false
    }
    return true
  }

  render () {
    const {store, history, routes} = this.props
    const authProtection = ::this.authCheck
    const routesWithAuthProtection = routes(authProtection)
    // console.log(routesWithAuthProtection)
    // key={Math.random()} = hack for HMR from https://github.com/webpack/webpack-dev-server/issues/395
    return (
      <Provider store={store}>
        <Router history={history}>
          {routesWithAuthProtection}
        </Router>
      </Provider>
    )
  }
}
<commit_msg>fix HMR<commit_after>import React, {Component} from 'react'
import PropTypes from 'prop-types'
import {Provider} from 'react-redux'
import {ConnectedRouter as Router} from 'react-router-redux'

export default class Root extends Component {
  static propTypes = {
    store: PropTypes.object,
    history: PropTypes.object,
    routes: PropTypes.func
  }

  /**
     * Checks Auth logic. Is user allowed to visit certain path?
     * @param  {String} path next path to visit
     * @return {Bool} is user allowed to visit next location?
     * check RouteAuth component.
     */
  authCheck (path) {
    const {store} = this.props
    const {loggedIn} = store.getState().auth
    const authPath = '/auth'
    const allowedToVisitPath = [authPath]
    if (loggedIn && path === authPath) {
      return false
    } else if (!loggedIn && !allowedToVisitPath.includes(path)) {
      return false
    }
    return true
  }

  render () {
    const {store, history, routes} = this.props
    const authProtection = ::this.authCheck
    const routesWithAuthProtection = routes(authProtection)
    // console.log(routesWithAuthProtection)
    // key={Math.random()} = hack for HMR from https://github.com/webpack/webpack-dev-server/issues/395
    return (
      <Provider key={Math.random()} store={store}>
        <Router key={Math.random()} history={history}>
          {routesWithAuthProtection}
        </Router>
      </Provider>
    )
  }
}

{'fraction_non_alphanumeric': 0.1147887323943662, 'fraction_numerical': 0.002112676056338028, 'mean_word_length': 3.0014084507042256, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, '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': '7642748', 'n_tokens_mistral': 839, 'n_tokens_neox': 844, 'n_words': 237}