-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Init effects not triggering other effects #1250
Comments
This is because the feature's effect hasn't been loaded yet when the root effects are loaded. |
I want a feature effect triggered by user login actions, whenever they occur in the application's lifecycle. And I want to dispatch a login action when the application is initialized, if the user is already logged in. Basically, I want to be able to defer init effects until all non-lazy loaded features have been loaded. E.g. when the app has actually finished initializing, not while it's still in the process of doing so. This seems like a pretty basic requirement!? I don't really see how the linked issue would solve it. It would let individual features know that they've been loaded, but it wouldn't let the application as a whole know that all features have been loaded. |
Because then you could do the following instead of using @Effect()
foo = this.actions.pipe(
ofType('feature/init'),
mapTo(new LoginAction())
); |
OK, that only tells me me that one feature has initialised though. If there are more, which there will be, I'm sounds like I'm going to have include a registry of all the features and their init state in the store, updating them when I receive an init action, checking if they're all ready, then dispatching I guess I can do that, although it feels like I'm adding a lot of app-level infrastructure to duplicate configuration and processing that ngrx/effects is presumably already handling. It already has a register of features, because I'm registering them using |
I don't think adding |
I guess it wouldn't, but it would help with statically loaded ones, which would still be an improvement on the current situation. |
Fixed via #1305 |
Minimal reproduction of the bug/regression with instructions:
Similar issue to #152
https://stackblitz.com/edit/ngrx-seed-fccfzh
Check the console.
Expected behavior:
Init effects should trigger other effects.
Versions of NgRx, Angular, Node, affected browser(s) and operating system(s):
Angular / NgRx: 6.1
I would be willing to submit a PR to fix this issue
[x] Yes (Assistance is provided if you need help submitting a pull request)
[ ] No
The text was updated successfully, but these errors were encountered: