Redux-devtools-extension: Infinite recursion when used with redux-history-transitions

Created on 3 Nov 2016  路  2Comments  路  Source: zalmoxisus/redux-devtools-extension

import {browserHistory} from 'react-router';
import {createStore, compose} from 'redux';
import createTransitionEnhancerFromHistory from 'redux-history-transitions';

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(
  state => state,
  {},
  composeEnhancers(
    createTransitionEnhancerFromHistory(browserHistory)
  )
);

store.dispatch({type: 'myAction'});

This causes Uncaught RangeError: Maximum call stack size exceeded as redux-history-transitions' dispatch continually calls itself. This does not occur when not using the extension or when only using other enhancers such as applyMiddleware and not redux-history-transitions. This also does not occur when using redux-devtools without the extension.

Most helpful comment

@gdaolewe, that's quite interesting, something related with how the dispatch is redefined there. I'll take a closer look tomorrow. Meanwhile, you can use the enhancer instead of window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:

import {browserHistory} from 'react-router';
import {createStore, compose} from 'redux';
import createTransitionEnhancerFromHistory from 'redux-history-transitions';

const store = createStore(
  state => state,
  {},
  compose(
    createTransitionEnhancerFromHistory(browserHistory),
    window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : noop => noop
  )
);

store.dispatch({type: 'myAction'});

All 2 comments

@gdaolewe, that's quite interesting, something related with how the dispatch is redefined there. I'll take a closer look tomorrow. Meanwhile, you can use the enhancer instead of window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:

import {browserHistory} from 'react-router';
import {createStore, compose} from 'redux';
import createTransitionEnhancerFromHistory from 'redux-history-transitions';

const store = createStore(
  state => state,
  {},
  compose(
    createTransitionEnhancerFromHistory(browserHistory),
    window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : noop => noop
  )
);

store.dispatch({type: 'myAction'});

Should work in 2.9.1.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

michaelwalloschke picture michaelwalloschke  路  3Comments

born2net picture born2net  路  4Comments

codeaid picture codeaid  路  3Comments

ismayilmalik picture ismayilmalik  路  4Comments

jhen0409 picture jhen0409  路  3Comments