Search code examples
angularngrxngrx-storeangular8

storeFreeze and ngrx8


I just mage an upgrade to ngrx/store version 8. I noticed that the ng update has removed all the occurrencies of storeFreeze. Is also removed it from the metaReducer.

So my question is - why?

Is there a problem using storeFreeze with ngrx 8?

before ngrx8:

import { ActionReducerMap, MetaReducer } from '@ngrx/store';
import { storeFreeze } from 'ngrx-store-freeze';
import * as fromGroupMember from './group-member.reducer';
import * as fromDirectoryForm from './directory-filter-form.reducer';

export const metaReducers: MetaReducer<IState>[] =
(localStorage && localStorage.getItem('production') === 'false') ? [storeFreeze] : [];

after:

import { ActionReducerMap, MetaReducer } from '@ngrx/store';

import * as fromGroupMember from './group-member.reducer';
import * as fromDirectoryForm from './directory-filter-form.reducer';

export const metaReducers: MetaReducer<IState>[] =
(localStorage && localStorage.getItem('production') === 'false') ? [] : [];

Solution

  • A migration was added on 8.0.0-rc.1 to remove the usage of ngrx-store-freeze as according to:

    The majority of our users are probably using ngrx-store-freeze to guard against state mutations. We have built-in run-time checks in version 8 to guard against those.

    See the github issue.