Skip to content

Commit

Permalink
refactor(shareReplay): align logic with var names (#2919)
Browse files Browse the repository at this point in the history
Change isComplete from being always true to representing whether or not
the source is actually complete.
  • Loading branch information
cartant authored and benlesh committed Oct 9, 2017
1 parent f55bfa5 commit 4dc73e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/operators/shareReplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function shareReplay<T>(bufferSize?: number, windowTime?: number, schedul
let refCount = 0;
let subscription: Subscription;
let hasError = false;
let isComplete = true;
let isComplete = false;

return (source: Observable<T>) => new Observable<T>(observer => {
refCount++;
Expand All @@ -37,7 +37,7 @@ export function shareReplay<T>(bufferSize?: number, windowTime?: number, schedul
return () => {
refCount--;
innerSub.unsubscribe();
if (subscription && refCount === 0 && !isComplete) {
if (subscription && refCount === 0 && isComplete) {
subscription.unsubscribe();
}
};
Expand Down

0 comments on commit 4dc73e4

Please sign in to comment.