I want to dispatch an action when ngrx store inits (@ngrx/store/init
). I created an Effect for that:
@Effect()
reloadConext$ = this.actions$.pipe(
ofType(INIT),
switchMap(() => {
console.log('INIT ACTION');
//dispatch my action here
return of([]);
}
The effect is not being fired when store init action is dispatched. I have effects modules for root registered in app.module :
EffectsModule.forRoot([AppEffects]),
If I remove the ofType
action filter the event is fired. Does anyone know what the filter for init action is not working?
Thanks in advance.