Closed jpmitche11 closed 6 years ago
Thanks. I really appreciate the StackBlitz reproduction.
Until I find and fix the problem, there is an alternate workaround. You can hide the shared observable from the spy, like this:
import { hide } from "rxjs-spy/operators";
const shared$ = interval(100).pipe(
share(),
hide()
);
Confirmed hide operator works around the issue. Thanks.
This should be fixed in 7.0.3.
Rxjs-spy is not handling connectable observables correctly. This will impact the multicast family of operators, including share.
When a shared observable is completely unsubscribed, then resubscribed later, normally the source observable is resubscribed. When there is a spy object created, this is not working. The share operator creates an internal subject, I see that is not being unsubscribed as well.
Here is some code that demonstrates the issue. The issue is present if a spy object has been created.
Here is a runnable version https://stackblitz.com/edit/rxjs-spy-share?file=index.ts