Using Share with observables derived from each other #6656
-
Hi, The problem is that when I subscribe multiple times, only the first subscribtion is going through as expected. The second subscription triggers with a previous value from interval$. This is a piece of code extracted and simplified from our application.
Here is another example where if I subscribe to test$ first I get expected behaviour but if I subscribe to test$ last I get previous value from interval$ in my test$ observable
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
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
When the second subscription to
Now, when
Something similar is happening on your second case. I think if you also were to share |
Beta Was this translation helpful? Give feedback.
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:When the second subscription to
test$
happens, the list of subscriptions becomes:Now, when
interval$
hits the value5
, it will notify each of their subscribers in order:interval$
notifieswithLatestFrom_0
: The first console.log subscription gets that the …