why the 'refcount: true' of ShareReplay
doesn't work like share
when source completes
#6722
Unanswered
loadingwyn
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I tried the example given by https://medium.com/volosoft/whats-new-in-rxjs-7-a11cc564c6c0
I thought 'b' subscription would output 'A, B .... E' again. Because 'a' sub has completed in 5000ms, refCount should become 0. And then
shared$
disconnects to the source. So when b subscribesshared$
, the source would restart. But the console showed only 'C, D, E' replayed by shareReplay.If I replace
shareReplay({refCount: true})
withshare()
, b will ouput as I expect. What is the root cause?You can play with my code: https://stackblitz.com/edit/azerz8?devtoolsheight=50
Beta Was this translation helpful? Give feedback.
All reactions