Reputation: 21
This is my code structure:
app/
├── core/
│ └── app.reducers.ts/
├── app.component.html
├── app.component.ts
├── app.module.ts
├── app-routing.module.ts
├── core/
│ ├── footer/
│ ├── header/
│ ├── core.module.ts
├── auth/
│ ├── signin/
│ ├── signup/
│ ├── store/
│ │ ├── auth.actions.ts
│ │ ├── auth.effects.ts
│ │ ├── auth.reducers.ts
│ ├── auth.module.ts
│ └── services/
├── admin/
│ ├── dashboard/
│ ├── setting/
│ ├── store/
│ │ ├── admin.actions.ts
│ │ ├── admin.effects.ts
│ │ ├── admin.reducers.ts
│ ├── admin-routing.module.ts
│ ├── admin.module.ts
│ └── services/
└── shared/
├── shared.module.ts
├── components/
├── models/
├── components/
├── directives/
└── services/
With the code above, I structured my code with multiple modules and using @ngrx/store library.For each module, I have a store (including: action, reducer, effect). I have one main store at root for managing all stores that are using metareducer (imported from app.module.ts). I am using logger to view each called action or changed state, then logger will show the current state or action in console log.
When the app starts, the console log from the browser showed multiple times that they are called by store.
I don't know why the update-reducers from store is called multiple times.
I expected log message for each module which will only show one time when the module is initialized. I investigated from many source codes which is store all reducer in one place. Is it good for my structure?
Can somebody help me?
Upvotes: 0
Views: 1430