I have a problem with my ngrx setup in that an effect is trying to run before the effects are initialised.
My Redux tool looks like this:
As you can see, my [Auth] Create Auth
is trying to run before @ngrx/effects/init
, and so the effect is not running.
How do I ensure the effects are intialised before any effects are executed/subscribed to?
Use the OnInitEffects
hook:
Implement this interface to dispatch a custom action after the effect has been added. You can listen to this action in the rest of the application to execute something after the effect is registered.
class UserEffects implements OnInitEffects {
ngrxOnInitEffects(): Action {
return { type: '[UserEffects]: Init' };
}
}