Reputation: 89
I am developing an enterprise Angular project using Angular CLI and NGRX version 10. Inside a component, I receive a state property via selector and then I change that object. I get no error and this is confusing for me because the state is immutable but it is muted without any error.
Upvotes: 2
Views: 1123
Reputation: 13574
By default ngrx doesn't detect such errors to improve performance.
If you want you can enable them during local development:
@NgModule({
imports: [
StoreModule.forRoot(reducers, {
runtimeChecks: {
strictStateImmutability: true, // <- what you need
strictActionImmutability: true, // <- what you need
strictStateSerializability: true,
strictActionSerializability: true,
strictActionWithinNgZone: true,
strictActionTypeUniqueness: true,
},
}),
],
})
export class AppModule {}
More info is here: https://ngrx.io/guide/store/configuration/runtime-checks
Upvotes: 3