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

Somehow warn developers about erring or completing @Effect Observables #1364

Closed
michahell opened this issue Oct 12, 2018 · 3 comments
Closed

Comments

@michahell
Copy link

michahell commented Oct 12, 2018

I think it is under-documented that, because @Effects are also Observables, they stop emitting values after erring or being completed.
I see waiting for something that never happens effectively as silently failing. As this happens more often when working with Observables, developers are used to it, but it could be expected that @Effects work differently.

It would be quite helpful to have a list of operators which are dangerous to use in @Effects, ie, operators that complete observables, such as first() and empty(), and using the catchError() operator in the 'main' Effect observable (as opposed to within switchMap, concatMap, map etc).

I suggest that either:

  • @Effects when they error ór complete, provide a warning regarding them being completed.
  • documentation is updated to reflect that developers have to be careful with certain operators (see list idea above) in @Effects.

related SO posts:

@michahell michahell changed the title Huge caveat with completing Effects which is not documented. Somehow warn developers about erring or completing @Effect Observables Oct 12, 2018
@timdeschryver
Copy link
Member

timdeschryver commented Oct 12, 2018

I believe #1224 would help here.

I think explaining the different (dangerous) operators inside the NgRx docs is not the right place. Perhaps we should add a catchError example and explicitly mention it, or add it to a "FAQ" section?

@michahell
Copy link
Author

michahell commented Oct 12, 2018

Yes, showing how to handle errors in an Effect would be a great start, or better said, how not to handle errors :)
I dont fully grok the safeCall operator yet, but it looks like the purpose is an operator with two end phases, either success or erring, which I think is the 99% use case indeed :)

@timdeschryver
Copy link
Member

I'll close this issue in favor of #1336 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants