Skip to content
kmathy edited this page Jan 1, 2018 · 1 revision

Debugging

How to debug your state management?

You have two solutions:

  • Use the meta-reducer logger (in app.store): This meta-reducer prints directly in the console of your browser.
  • Use StoreDevTool: You'll need to follow these instructions to use properly this tool

By default, logger is enabled.

Enable/Disable the meta-reducer logger

If you want to disable the meta-reducer, you just need to remove logger in app.store:

export const metaReducers: MetaReducer<State>[] = !environment.production
    ? [logger, storeFreeze] --> remove logger here
    : [];

To re-enable, just add it in the array.

Enable/Disable StoreDevTool

It uses a module, so in your StoreReduxorModule, just (un)comment the line importing the StoreDevTool:

@NgModule({
    imports: [
        HttpClientModule,
        StoreModule.forRoot(reducers, { metaReducers }),
        EffectsModule.forRoot([...AllEffects]),
        StoreDevtoolsModule.instrument({ // (Un)comment here to disable/enable
            maxAge: 25, //  Retains last 25 states
        })
    ],
    ...
})
export class StoreReduxorModule {

Pay attention to follow properly the instructions to use it