Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
N

ngrx-store-freeze

> 前端框架
Open source

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

197 stars0 likes1 views
WebsiteGitHub

About

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

ngrx-store-freeze

ngrx-store-freeze is a meta-reducer that prevents state from being mutated

  • Recursively freezes the current state, the dispatched action payload if provided and the new state.
  • When mutation occurs, an exception will be thrown.
  • Should be used only in development to ensure that the state remains immutable.

Installation

bash
npm i --save-dev ngrx-store-freeze

OR

bash
yarn add ngrx-store-freeze --dev

Setup

typescript
import { StoreModule, MetaReducer, ActionReducerMap } from '@ngrx/store';
import { storeFreeze } from 'ngrx-store-freeze';
import { environment } from '../environments/environment'; // Angular CLI environment

export interface State {
  // reducer interfaces
}

export const reducers: ActionReducerMap = {
  // reducers
}

export const metaReducers: MetaReducer[] = !environment.production ? [storeFreeze]: [];

@NgModule({
  imports: [
    StoreModule.forRoot(reducers, { metaReducers }),
  ]
})
export class AppModule {}

Additional Documentation

  • Usage with @ngrx/router-store

Credits

redux-freeze - Redux middleware that prevents state from being mutated
Attila Egyed - The original maintainer of this project

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptangularngrx

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架