-
-
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): make resubscription handler overridable #2295
feat(effects): make resubscription handler overridable #2295
Conversation
Preview docs changes for f2e40f2 at https://previews.ngrx.io/pr2295-f2e40f2/ |
13b52ab
to
b3f2aa1
Compare
c497db3
to
35ffbcc
Compare
Closing this along with #2294 |
@brandonroberts would you mind reopening this PR please given #2294 was reopened? |
35ffbcc
to
1970330
Compare
1970330
to
6e6ca22
Compare
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.
Correct me if I'm wrong, if we set EFFECTS_ERROR_HANDLER
in any of the modules, it would override the default effects error handle for all the effects classes.
I think we need something that we can pass to a particular EffectsModule
either forRoot
or forChild
and it would apply only to that group of Effects. WDYT?
d3ce151
to
1a7771c
Compare
@alex-okrushko Hmmm this is an interesting thought - I'm not sure that I'm convinced that the effects grouping is the level that developers would want to customise the behaviour, because at that point they would have limited ability to customise the behavior on a per-class basis. Perhaps the better solution to address that case would be to (maybe later) introduce a new hook, and if developers desire grouping within a module it could be done through inheritance or a custom decorator if they so choose. e.g. class MyEffects implements EffectErrorHandler {
ngrxEffectErrorHandler(action$: Observable<Action>, errorHandler: ErrorHandler) {
// ...
}
effect$ = createEffect(...);
} This would be more expected IMO considering similar control behavior with |
1a7771c
to
ce04423
Compare
This is still on my radar - will try to get some time to review it tomorrow. |
@alex-okrushko yea no problem, whenever is fine |
9869378
to
6a240c0
Compare
BREAKING CHANGE: `resubscribeOnError` renamed to `useEffectsErrorHandler` in `createEffect` metadata Closes ngrx#2294
…DLER non optional, moving provider up to EffectsModule
79deb41
to
693161b
Compare
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.
Thanks for working on it 👍
Migration path is a simple rename, an automated migration with a schematic is theoretically possible (I've not done this before but willing to learn).
Let's look into that as well - in another PR :)
I like the API this PR provides, good job 👍
Yes, this is possible and should be a simpler one. |
674a7c5
to
25d8ad7
Compare
@timdeschryver thanks, I'm going to take a crack at the migration PR, I'll let you know if/when I need a hand. I've got the basics working already, just need to narrow the visitor so it's not just doing a dangerous global find/replace. I'll open the PR this weekend to discuss over. I'll keep this PR for the actual change 👍 |
…lt handler to describe purpose better.
25d8ad7
to
f2e40f2
Compare
PR Checklist
Please check if your PR fulfils the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Behavior of resubscription to closed observables is not configurable
Closes #2294
What is the new behavior?
Behavior of resubscription to closed observables is now configurable by injecting a substitute implementation.
Does this PR introduce a breaking change?
Impact is relatively low - it is a simple rename of a field that was introduced in v8. See @alex-okrushko's comment - he found nowhere in google that is using this feature yet.
Migration path is a simple rename, an automated migration with a schematic is theoretically possible (I've not done this before but willing to learn).