feat(Effects): Add root effects init action#473
Conversation
| @Optional() storeModule: StoreModule | ||
| ) { | ||
| runner.start(); | ||
| store.dispatch({ type: ROOT_EFFECTS_INIT }); |
There was a problem hiding this comment.
I think this needs to be beneath the lines where you add the effects.
There was a problem hiding this comment.
Changed.
Why exactly 😄 ?
There was a problem hiding this comment.
Dispatching and registering the effects happens synchronously. Moving the dispatch to after registering the effects will give the effects a chance to listen for this new action type.
| import { EffectSources } from './effect_sources'; | ||
| import { ROOT_EFFECTS } from './tokens'; | ||
|
|
||
| export const ROOT_EFFECTS_INIT = '@ngrx/store/root effects init' as '@ngrx/store/root effects init'; |
There was a problem hiding this comment.
I would rename the type string to @ngrx/effects/init
There was a problem hiding this comment.
Yep you're right, don't know what I was thinking!
|
Thanks @tdeschryver! |
|
I am just wondering ... is this supposed to work in feature effects ( If I use: in root module, it works (it logs). When I use it in feature module, it does not (it does not log). I would need this for feature module though... :) |
Closes #246