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

class AppContainer extends Component {
  static propTypes = {
    routes : PropTypes.object.isRequired,
    store  : PropTypes.object.isRequired
  }

  constructor (props) {
    super(props)
    this.state = { rehydrated: false }
  }

  componentWillMount () {
    const { store } = this.props

    // begin periodically persisting the store
    window._persistor = persistStore(store, null, () => {
      this.setState({ rehydrated: true })

      // if it looks like we have/had a valid session
      if (store.getState().user.userId !== null) {
        window._socket.open()
      }
    })
  }

  render () {
    const { routes, store } = this.props

    if (!this.state.rehydrated) {
      return (<div>Loading...</div>)
    }

    return (
      <Provider store={store}>
        <div style={{ height: '100%' }}>
          <Router history={browserHistory} children={routes} />
        </div>
      </Provider>
    )
  }
}

export default AppContainer<commit_msg>Use PersistGate from redux-persist<commit_after>import PropTypes from 'prop-types'
import React, { Component } from 'react'
import { browserHistory, Router } from 'react-router'
import { Provider } from 'react-redux'
import { persistStore } from 'redux-persist'
import { PersistGate } from 'redux-persist/es/integration/react'

class AppContainer extends Component {
  static propTypes = {
    routes : PropTypes.object.isRequired,
    store  : PropTypes.object.isRequired
  }

  componentWillMount () {
    const { store } = this.props

    // begin periodically persisting the store
    window._persistor = persistStore(store, null, () => {
      // if it looks like we have/had a valid session
      if (store.getState().user.userId !== null) {
        window._socket.open()
      }
    })
  }

  render () {
    const { routes, store } = this.props

    return (
      <Provider store={store}>
        <PersistGate
          loading={null}
          persistor={window._persistor}
        >
          <div style={{ height: '100%' }}>
            <Router history={browserHistory} children={routes} />
          </div>
        </PersistGate>
      </Provider>
    )
  }
}

export default AppContainer
{'fraction_non_alphanumeric': 0.12473925740508969, 'fraction_numerical': 0.0025031289111389237, 'mean_word_length': 2.6554878048780486, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, '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': '7635183', 'n_tokens_mistral': 720, 'n_tokens_neox': 703, 'n_words': 177}