Reputation: 16373
Using @ngrx/store this error popped up:
index.js?4b23:19 State mutation is prohibited inside of reducers.
(anonymous) @ index.js?4b23:19
(anonymous) @ index.ts:54
rootReducer @ index.ts:70
_initialStateFactory @ ng2.ts?2a33:24
AppModuleInjector.createInternal @ module.ngfactory.js:425
NgModuleInjector.create @ ng_module_factory.js?95b1:132
NgModuleFactory.create @ ng_module_factory.js?95b1:100
(anonymous) @ application_ref.js?0421:340
ZoneDelegate.invoke @ zone.js?e3a6:229
onInvoke @ ng_zone.js?b62b:269
ZoneDelegate.invoke @ zone.js?e3a6:228
Zone.run @ zone.js?e3a6:113
NgZone.run @ ng_zone.js?b62b:138
PlatformRef_._bootstrapModuleFactoryWithZone @ application_ref.js? 0421:338
(anonymous) @ application_ref.js?0421:389
ZoneDelegate.invoke @ zone.js?e3a6:229
Zone.run @ zone.js?e3a6:113
(anonymous) @ zone.js?e3a6:509
ZoneDelegate.invokeTask @ zone.js?e3a6:262
Zone.runTask @ zone.js?e3a6:151
drainMicroTaskQueue @ zone.js?e3a6:405
ZoneTask.invoke @ zone.js?e3a6:336
main.browser.ts:18 TypeError: Cannot set property 'actions$' of undefined
at CatBibleEffects (catBible.effects.ts:15)
at combination (utils.ts?b1fc:23)
at index.js?39b4:125
at index.js?4b23:16
at index.ts:54
at rootReducer (index.ts:70)
at _initialStateFactory (ng2.ts?2a33:24)
at AppModuleInjector.createInternal (module.ngfactory.js:425)
at AppModuleInjector.NgModuleInjector.create (ng_module_factory.js?95b1:132)
at NgModuleFactory.create (ng_module_factory.js?95b1:100)
at application_ref.js?0421:340
at ZoneDelegate.invoke (zone.js?e3a6:229)
at Object.onInvoke (ng_zone.js?b62b:269)
at ZoneDelegate.invoke (zone.js?e3a6:228)
at Zone.run (zone.js?e3a6:113)
Upvotes: 0
Views: 620
Reputation: 3474
The State mutation is prohibited inside of reducers
error seems to be returned when errors are caught from a reducer... here's the ngrx-store-freeze/dist/index.js
code where the catch
that returns this error lives...
function storeFreeze(reducer) {
return function (state, action) {
if (state === void 0) { state = {}; }
deepFreeze(state);
// guard against trying to freeze null or undefined types
if (action.payload) {
deepFreeze(action.payload);
}
var nextState;
try {
nextState = reducer(state, action);
}
catch (error) {
console.error('State mutation is prohibited inside of reducers.');
throw error;
}
deepFreeze(nextState);
return nextState;
};
}
exports.storeFreeze = storeFreeze;
Therefore your error may truly be related to state being inappropriately altered or it could just mean that an uncaught error propagated out of a call to your reducer...
Upvotes: 2
Reputation: 16373
This error had nothing to do with my effects file or my action file. I forgot to rename the reducer function after copying from a similar file. This also caused the call to this reducer to be named wrong in the main root reducer file as well.
Upvotes: 1