NgRx update
See V9 Update Guide for more details.
Creators syntax
v8 introduced a less verbose syntax following a Good Action Hygiene. It is used by default in v9 (all schematics).
See NgRx: Action Creators redesigned & NgRx creator functions 101 for more details.
createAction
createReducer
Avoid switch statement ➕ no need for a default case.
createEffect
Type safe (i.e. if the effect does not return an Observable\<Action> it will give compile errors).
Runtime checks
4 runtime checks where introduced in v8 (replacing the ngrx-store-freeze
package):
strictStateImmutability
: to verify that the state isn’t mutatedstrictActionImmutability
: to verify that actions aren’t mutatedstrictStateSerializability
: to verify if the state is serializablestrictActionSerializability
: to verify if the actions are serializable
v9 enabled strictStateImmutability
and strictActionImmutability
by default in development and added strictActionWithinNgZone
.
@NgModule({
imports: [
StoreModule.forRoot(reducers, {
runtimeChecks: {
// strictStateImmutability: true,
// strictActionImmutability: true,
strictStateSerializability: true,
strictActionSerializability: true,
strictActionWithinNgZone: true,
},
}),
],
})
export class AppModule {}
Deprecrations
- v9: @nrgx/entity
addAll
➡️setAll