Skip to content
Discussion options

You must be logged in to vote

This is something that often catches many people off-guard. There's a related discussion here: #6605

It has to do with the order of subscriptions.

In your first case, as soon as you subscribe to test$, the list of subscribers for each shared observable would be:

interval$: [withLatestFrom_0, trigger$]
trigger$: [withLatestFrom_0]

When the second subscription to test$ happens, the list of subscriptions becomes:

interval$: [withLatestFrom_0, trigger$, withLatestFrom_1]
trigger$: [withLatestFrom_0, withLatestFrom_1]

Now, when interval$ hits the value 5, it will notify each of their subscribers in order:

  1. interval$ notifies withLatestFrom_0: The first console.log subscription gets that the …

Replies: 1 comment 1 reply

Comment options

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

Answer selected by jarkkoskyttala
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