Angular 来自ngrx的关于运行时检查的警告
我使用Angular 来自ngrx的关于运行时检查的警告,angular,ngrx,ngrx-store,Angular,Ngrx,Ngrx Store,我使用ng update将我的应用程序从Angular 7升级到Angular 8。当我通过ngserve运行它时,控制台上会从ngrx打印一条警告: @ngrx/store: runtime checks are currently opt-in but will be the default in the next major version with the possibility to opt-out, see https://ngrx.io/guide/migration/v8 for
ng update
将我的应用程序从Angular 7升级到Angular 8。当我通过ngserve
运行它时,控制台上会从ngrx
打印一条警告:
@ngrx/store: runtime checks are currently opt-in but will be the default in the next major version with the possibility to opt-out, see https://ngrx.io/guide/migration/v8 for more information.
所提供链接中的文档讨论了被弃用的
ngrx商店冻结。但是,我的应用程序没有使用ngrx存储冻结,我不知道什么是“运行时检查”。我需要在代码中更改什么来解决此警告的来源?此警告是因为在NGRX<8中,为了使存储不可变,我们需要使用NGRX存储冻结库。在NGRX 8中,您可以选择加入使存储不可变而不冻结NGRX存储[因为它现在在NGRX 8中内置]。如果您通过在StoreModule.forRoot
中指定runtimeChecks
属性来选择存储不变性,则此警告将消失,如下所示:
StoreModule.forRoot(rootReducer, {
runtimeChecks: {
strictStateImmutability: true,
strictActionImmutability: true
}
})
例如:
@NgModule({
imports: [
CommonModule,
StoreModule.forRoot(rootReducer, {
runtimeChecks: {
strictStateImmutability: true,
strictActionImmutability: true
}
}),
]
})
export class AppModule {}
参考:
希望这能有所帮助。packagej.json文件中引用了哪个版本的ngrx?