Skip to content

Where to put in a chain of operators? #167

Answered by Rush
dandean asked this question in Q&A
Discussion options

You must be logged in to vote

Last - Source: https://cartant.medium.com/rxjs-avoiding-takeuntil-leaks-fb5182d047ef

The general rule is for takeUntil to be placed last. However, there are some situations in which you might want want use it as the second-last operator.

RxJS includes several operators that emit a value when the source observable to which they are applied completes. For example, when their sources complete, count emits a count of the values emitted by the source and toArray emits an accumulated array of values.

When an observable completes due to takeUntil, operators like count and toArray will only emit a value if they are placed after the takeUntil operator.

Additionally, there is another operato…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@dandean
Comment options

Answer selected by dandean
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants