JSPM

ku-ngrx-store-freeze

0.1.12
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q33407F
  • License MIT

@ngrx/store meta reducer that prevents state from being mutated.

Package Exports

  • ku-ngrx-store-freeze

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ku-ngrx-store-freeze) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ngrx-store-freeze

NPM

@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)
]);