Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrome Error: Maximum Call Stack Exceeded #37

Open
carpben opened this issue May 13, 2018 · 7 comments
Open

Chrome Error: Maximum Call Stack Exceeded #37

carpben opened this issue May 13, 2018 · 7 comments

Comments

@carpben
Copy link

carpben commented May 13, 2018

I think it's a very important library for the Redux community.

I installed the library locally according to the instructions. Here is a production version of the app https://next-f2cee.firebaseapp.com/. I expect there to be some mutations and I wonder where. However I received this error, which doesn't seem to relate to a redux/state mutation:
image

Here is my index.js:

import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { createStore, applyMiddleware, compose } from 'redux'
import nextApp from './reducers'
import AppContainer from './containers/AppContainer.js'
import thunk from 'redux-thunk'

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

const middlewares = process.env.NODE_ENV !== 'production' ?
  [require('redux-immutable-state-invariant').default(), thunk] :
  [thunk];

  const store = createStore(nextApp, composeEnhancers(applyMiddleware(...middlewares)));

//let store = createStore(nextApp)

render(
  <Provider store={store}>
    <AppContainer />
  </Provider>,
  document.getElementById('root')
)
@carpben
Copy link
Author

carpben commented May 14, 2018

I also tried to use ES6 modules as I usually do:

import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware, compose } from 'redux';
import nextApp from './reducers';
import AppContainer from './containers/AppContainer.js';
import thunk from 'redux-thunk';
import mutationShouter from 'redux-immutable-state-invariant';

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

const middlewares = process.env.NODE_ENV !== 'production' ?  [mutationShouter, thunk] : [thunk];

const store = createStore(nextApp, composeEnhancers(applyMiddleware(...middlewares)));

//let store = createStore(nextApp)

render(
  <Provider store={store}>
    <AppContainer />
  </Provider>,
  document.getElementById('root')
);

It resulted in an error:

TypeError: getState is not a function
(anonymous function)
C:/Users/carpb/projects/notifications/node_modules/redux-immutable-state-invariant/dist/index.js:41
  38 | return function (_ref) {
  39 |   var getState = _ref.getState;
  40 | 
> 41 |   var state = getState();

@leoasis
Copy link
Owner

leoasis commented Jun 18, 2018

This library works out of the box with POJOS and arrays and native JS types, so maybe this is happening because you have custom classes or Maps or Sets? If so, you can use something like isImmutable?

@carpben
Copy link
Author

carpben commented Jun 21, 2018

Sorry I'm not using ImmutableJS, just plain old JS objects. Perhaps I should mention that I'm working on Windows.

@leoasis
Copy link
Owner

leoasis commented Jun 25, 2018

Are you doing any kind of circular dependency in your JS objects? What seems to be happening is that an object may be referencing itself directly or indirectly, making the trackForMutations function never finish.

@carpben
Copy link
Author

carpben commented Jul 2, 2018

Probably not. If there was a circular dependency I'd expect the app not to work at all. But the app works on a daily basis. Isn't it so?

@chirva-ivan
Copy link

Got the same issue, it's appears after migration into latest version of "redux": "4.0.1"

@santiagopuentep
Copy link

Same issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants