Skip to content

of emits a value after take(n) should've already unsubscribed #7366

Answered by voliva
OmerGronich asked this question in Q&A
Discussion options

You must be logged in to vote

I think this is expected:

  • of emit all of the values synchronously.
  • The first concatMap keeps all of those emissions on a buffer, as it needs to run the map function for each one of them.
  • For each one, it waits for a microtask to complete before moving to the next one.
  • The second concatMap does the same: It will wait for a microtask to complete before moving to the next one.
  • Then take(3) will unsubscribe once the second concatMap has emitted for the 3rd time.
  • But before that happens, the first concatMap had values on their buffer, so they will start mapping it before the second concatMap emits the 3rd value.

I hope this explains it 🙏

Replies: 1 comment

Comment options

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