Nicholas Jamieson
1 min readAug 26, 2018

--

IIRC, shareReplay is the problem. There is some debate about its current implementation — which was changed in version 5.5.0-beta.4.

Essentially, the current implementation of shareReplay will never unsubscribe from its source observable. When used, it relies upon the source observable either completing or erroring.

So, yes, you are correct in that placing takeUntil before shareReplay is necessary to effect unsubscription from the source.

Perhaps I should add another rule to rxjs-tslint-rules that warns about shareReplay being used? Or should make the takeUntil rule aware of the shareReplay quirk?

--

--

Nicholas Jamieson
Nicholas Jamieson

Written by Nicholas Jamieson

RxJS core team member; front-end developer; mentor; speaker; open-source contributor

No responses yet