Skip to content
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

fix(effects): resubscribe every time an error occurs #2165

Merged
merged 3 commits into from
Oct 19, 2019

Conversation

timdeschryver
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Closes #

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Seems like with the original PR we forgot to modify the spec for the usage with createEffect. This PR uses the same implementation as the original PR.

History:

// Return observable that produces this particular effect
return resubscribeInCaseOfError(observable$);
})
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please make it as a package-private function declaration and put it outside of mergeEffects?

@@ -24,14 +24,19 @@ export function mergeEffects(
? sourceInstance[propertyName]()
: sourceInstance[propertyName];

const resubscribeInCaseOfError = (
observable$: Observable<any>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both any should be replaced with T to make sure that both Observables are of the same kind.

@ngrxbot
Copy link
Collaborator

ngrxbot commented Oct 16, 2019

Preview docs changes for a6e9ba1 at https://previews.ngrx.io/pr2165-a6e9ba1/

/**
* @internal
*/
export function resubscribeInCaseOfError<T extends Action = Action>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to export it, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, it also doesn't need the @internal comment

/**
* @internal
*/
export function resubscribeInCaseOfError<T extends Action = Action>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is = Action needed? I think just extending Action is fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it isn't needed. Thanks for the review 👍

@ngrxbot
Copy link
Collaborator

ngrxbot commented Oct 17, 2019

Preview docs changes for 5151b3d at https://previews.ngrx.io/pr2165-5151b3d/

@brandonroberts brandonroberts merged commit 0d59783 into master Oct 19, 2019
@brandonroberts brandonroberts deleted the pr/subscribe-on-effect-error branch October 19, 2019 17:53
jordanpowell88 pushed a commit to jordanpowell88/platform that referenced this pull request Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants