I upgraded my app from Angular 7 to Angular 8 using ng update
. When I run it via ng serve
, There's a warning printed in my console from 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.
The documentation at the provided link talks about ngrx-store-freeze
being deprecated. However, my application does not use ngrx-store-freeze
, and I have no idea what a "runtime check" is. What do I need to change in my code to address the source of this warning?
This warning is coming because in NGRX < 8, to make store immutable, we need to use ngrx-store-freeze library. In NGRX 8, you can opt-in to make store immutable without ngrx-store-freeze [as it is in build now in NGRX 8]. This warning will go away if you opt in-store immutability by specifying
runtimeChecks
property inStoreModule.forRoot
like this:Example:
Ref: https://medium.com/ngrx/announcing-ngrx-version-8-ngrx-data-create-functions-runtime-checks-and-mock-selectors-a44fac112627
Hope this helps.