forked from cartant/eslint-plugin-rxjs
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
Putting shareReplay
before takeUntil
with refCount: false
may cause unexpected behavior because the source observable will not be unsubscribed. See the "An update" section in this blog post: https://ncjamieson.com/avoiding-takeuntil-leaks/#an-update . We should implement a new rule that errors on this case.
import { Subject, interval, tap, shareReplay, takeUntil } from 'rxjs';
const destroy = new Subject<void>();
const ticker = interval(1000).pipe(
tap(value => console.log(value)),
shareReplay({ refCount: false }),
takeUntil(destroy),
).subscribe();
destroy.next();
// Despite the takeUntil causing an unsubscribe, the shareReplay remains open and the interval will keep going.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request