Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NgRx Redux devtools not showing store and state details even though applicaton is working fine

I am using the below sample application to learn angular+ngrx. APM Sample NgRx App

I have installed Redux firefox extension. But whenever I run/reload application, redux tab shows 'No store found' message. The application is working as expected(is able to retain state). I am able to dispatch actions, handle it in the reducer etc.. Please help.. I am stuck in this for quite a long time.

like image 803
know_a_guy_hu_knows_anothr_guy Avatar asked Oct 02 '18 19:10

know_a_guy_hu_knows_anothr_guy


People also ask

How do I open Redux DevTools in Chrome DevTools?

Hit Ctrl+Shift+I, or F12. You will then open up the Developer Tools. You will see a Redux tab at the end of Developer Tools.

Is NgRx store an observable?

The NgRX Store imports the state management concepts from Redux and adds to them RxJS to provide an observable means of communication throughout the Store APIs, thus giving Angular developers a familiar experience in developing Angular apps.


2 Answers

There is an issue with Angular app when Redux doesn't see your Store

Check that you have

StoreDevtoolsModule.instrument({maxAge: 25, logOnly: environment.production})

after

StoreModule.forRoot(reducers)

Otherwise you are in trouble.

BTW, it is better to install DevTools with

ng add @ngrx/store-devtools

It adds schematics to the project.

like image 59
v-andrew Avatar answered Nov 14 '22 07:11

v-andrew


To use the Redux devtools you'll have to install @ngrx/store-devtools and import it in the AppModule - docs.

Install it with:

npm install @ngrx/store-devtools --save 

Import it with:

@NgModule({
  imports: [
    StoreModule.forRoot(reducers),
    // Instrumentation must be imported after importing StoreModule (config is optional)
    StoreDevtoolsModule.instrument({
      maxAge: 25, // Retains last 25 states
      logOnly: environment.production, // Restrict extension to log-only mode
    }),
  ],
})
export class AppModule {}
like image 28
timdeschryver Avatar answered Nov 14 '22 05:11

timdeschryver