-
-
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
feat(Effects): dispatch init feature effects action on init #1305
feat(Effects): dispatch init feature effects action on init #1305
Conversation
import { getSourceForInstance } from './effects_metadata'; | ||
|
||
export const FEATURE_EFFECTS_INIT = '@ngrx/feature-effects/init'; | ||
export type FeatureEffectsInit = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why I created this is to be typesafe, see the effects test case for a "demo".
99f391c
to
0e4cdd2
Compare
import { EffectsRootModule } from './effects_root_module'; | ||
import { FEATURE_EFFECTS } from './tokens'; | ||
import { getSourceForInstance } from './effects_metadata'; | ||
|
||
export const FEATURE_EFFECTS_INIT = '@ngrx/feature-effects/init'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the prefix should remain @ngrx/effects/something
. What about @ngrx/effects/(update-effects or update)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea you're right.
My vote goes for @ngrx/effects/update-effects
to keep things consistent with @ngrx/store/update-reducers
.
Plus we wouldn't need to change the root effects:
I also would want to change the root effects action name (this will be a breaking change) to make it more clear that it's initiated by the root effects: from @ngrx/effects/init to @ngrx/root-effects/init
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
d17dac7
to
68f88c7
Compare
68f88c7
to
90ca432
Compare
docs/effects/api.md
Outdated
### UPDATE_EFFECTS | ||
|
||
After feature effects have been registered, a `UPDATE_EFFECTS` action will be dispatched. | ||
This action will have all registered effects as its payload. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
action has all newly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be sure, you mean that this can be removed right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, just update. This action has all newly registered effects as its payload.
Nice. Just what i needed. |
Keep in mind this isn't released yet @ThomasBurleson - if you need it now you can install from the nightly builds. |
During a prod build the contructor name of an effect gets magnled, therefore this implementation can't be used.
During a prod build the contructor name of an effect gets magnled, therefore this implementation can't be used.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #683
What is the new behavior?
Does this PR introduce a breaking change?
Other information
If we agree on the API, I'll also add these changes to the docs.
I also would want to change the root effects action name (this will be a breaking change) to make it more clear that it's initiated by the root effects: from
@ngrx/effects/init
to@ngrx/root-effects/init
.Closes #683