<commit_before>import { get } from 'lodash'
import { LOCATION_CHANGE } from 'react-router-redux'
import { routerReducer } from 'react-router-redux'

const previousPath = typeof document === 'undefined' ? '/' : document.location.pathname

// Merge our initial state with routerReducer's initial state
const initialState = {
  ...routerReducer(undefined, { type: null, payload: null }),
  previousPath,
}

export function routeReducer(state = initialState, { type, payload: location }) {
  const newState = routerReducer(state, { type, payload: location })

  if (type !== LOCATION_CHANGE) {
    return newState
  }
  return {
    ...newState,
    previousPath: get(state, 'locationBeforeTransitions.pathname'),
  }<commit_msg>Stick the location thing back<commit_after>import { get } from 'lodash'
import { LOCATION_CHANGE } from 'react-router-redux'
import { routerReducer } from 'react-router-redux'

const previousPath = typeof document === 'undefined' ? '/' : document.location.pathname

// Merge our initial state with routerReducer's initial state
const initialState = {
  ...routerReducer(undefined, { type: null, payload: null }),
  previousPath,
}

export function routeReducer(state = initialState, { type, payload: location }) {
  const newState = routerReducer(state, { type, payload: location })

  if (type !== LOCATION_CHANGE) {
    return newState
  }
  return {
    ...newState,
    location: {
      pathname: get(newState, 'locationBeforeTransitions.pathname'),
    },
    previousPath: get(state, 'locationBeforeTransitions.pathname'),
  }
{'fraction_non_alphanumeric': 0.12195121951219512, 'fraction_numerical': 0.0, 'mean_word_length': 4.413194444444445, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3272540', 'n_tokens_mistral': 471, 'n_tokens_neox': 455, 'n_words': 122}