ngrx-store-freeze
@ngrx/store meta reducer that prevents state from being mutated. When mutation occurs, an exception will be thrown. This is useful during development mode to ensure that no part of the app accidentally mutates the state. Ported from redux-freeze
Usage
You should only include this meta reducer (middleware) in development environment.
npm i --save-dev ngrx-store-freeze
import { bootstrap } from '@angular/platform-browser-dynamic';
import { compose } from '@ngrx/core/compose';
import { combineReducers, provideStore } from '@ngrx/store';
import { storeFreeze } from 'ngrx-store-freeze';
import { TodoApp } from './todo-app.component';
import { todoReducer, visibilityFilterReducer } from './reducers'
const metaReducers = __IS_DEV__
? [storeFreeze, combineReducers]
: [combineReducers];
const store = compose(...metaReducers)({
todos: todoReducer,
visibilityFilter: visibilityFilterReducer
});
bootstrap(TodoApp, [
provideStore(store)
]);