Open carpben opened 6 years ago
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();
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
?
Sorry I'm not using ImmutableJS, just plain old JS objects. Perhaps I should mention that I'm working on Windows.
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.
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?
Got the same issue, it's appears after migration into latest version of "redux": "4.0.1"
Same issue here.
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](https://user-images.githubusercontent.com/13496178/39966048-ceee4e1a-56ad-11e8-9d90-b4216975f645.png)
Here is my index.js: