Actions must be plain objects. Use custom middleware for async actions.
See original GitHub issuePreviously it was working properly in ie11,However I am facing this issue from last week in IE11.It works on both firefox and chrome.
store.js `import rootReducer from ‘…/reducers’; import thunk from ‘redux-thunk’; import {applyMiddleware, compose, createStore} from ‘redux’; import createLogger from ‘redux-logger’; import routes from ‘…/routes’; import createHistory from ‘history/lib/createHashHistory’; import {reduxReactRouter} from ‘redux-router’; import config from ‘…/common/config’;
export default function configureStore(initialState) { let createStoreWithMiddleware;
const logger = createLogger();
let history = createHistory({
queryKey: false
});
let middleware = applyMiddleware(thunk, logger);
if(config.Environment == 'PROD'){
middleware = applyMiddleware(thunk);
}
createStoreWithMiddleware = compose(
middleware,reduxReactRouter({ routes, history })
);
const store = createStoreWithMiddleware(createStore)(rootReducer, initialState);
if (module.hot) {
module.hot
.accept('../reducers', () => {
const nextRootReducer = require('../reducers/index');
store.replaceReducer(nextRootReducer);
});
}
return store;
} `
package.json
...... "dependencies": { "babel": "^5.8.23", "babel-core": "^5.2.17", "babel-loader": "^5.0.0", "body-parser": "^1.12.4", "cookie-parser": "^1.3.3", "debug": "^2.2.0", "dotenv": "^1.2.0", "errorhandler": "^1.4.2", "es6-promise": "^3.0.2", ..... "highcharts": "5.0.0", "history": "^1.9.0", ..... "lodash": "^4.13.1", "material-ui": "0.18.2", "material-ui-pagination": "^1.0.1", .... "react": "15.4.1", "react-addons-css-transition-group": "^15.2.1", "react-addons-linked-state-mixin": "^15.2.1", ... "react-redux": "^4.4.5", "react-router": "^2.6.0", "react-tap-event-plugin": "2.0.1", "redux": "^3.5.2", "redux-logger": "^2.6.1", "redux-router": "^2.0.0", "redux-thunk": "^2.1.0", "rimraf": "^2.5.2" }, "devDependencies": { "babel-loader": "^5.0.0", "file-loader": "^0.8.4", "redux-devtools": "^3.0.1", "redux-devtools-dock-monitor": "^1.0.1", "redux-devtools-log-monitor": "^1.0.1", "webpack": "^1.11.0", "webpack-dev-server": "^1.10.1" }, ......
Need Help please.
Issue Analytics
- State:
- Created 6 years ago
- Comments:10
This thread helped a lot when debugging what was going on. Thanks @nachein & others!
For us, this actually had nothing to do with
redux-thunk
(we don’t use it). We saw this issue viaredux
itself:redux
callslodash
’sisPlainObject
function.Without google maps,
isPlainObject
seemed to work as expected. But when we included the google maps API withv>=3.30
,isPlainObject({})
would (crazily) returnfalse
!While debugging I noticed that
{}.toString
returned"[Object Array Iterator]"
which I think confusedlodash
.I can only assume Google Maps is writing to
Object.prototype
somewhere, or otherwise messing with the browser environment.you are totally right @dmnd, about not being related to redux-thunk but redux itself, and about
isPlainObject
issue.After a bit of debugging I can see that the error occurs on reduxs’ init action, and if I test
isPlainObject({})
I also get false.EDIT:
Another info I can provide is that on my case, it’s only happening on production builds (minified) and not on dev builds.
EDIT2:
Also can confirm that
({}).toString()
is returning[object Array Iterator]
with gmaps v3 and[object Object]
on gmaps v3.29.This is making
isPlainObject
return false and true respectively.EDIT3:
I don’t think Google Maps is writing Object prototype. What I can see is a difference on Symbol.toStringTag, which from what I read, is used internally on Object.toString:
Since IE11 does not support Symbol, there may be a conflict between gmaps and the polyfill.
When running
Symbol.toStringTag
;jscomp_symbol_Symbol.toStringTag1
This is what makes lodash
isPlainObject
return false (baseGetTag(value) != objectTag
).