Skip to content

Commit

Permalink
fix(expand): terminate recursive call when destination completes
Browse files Browse the repository at this point in the history
relates to #766
  • Loading branch information
kwonoj committed Nov 30, 2015
1 parent 01f86e5 commit 3b8cf94
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/operators/expand-support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,19 @@ export class ExpandSubscriber<T, R> extends OuterSubscriber<T, R> {
}

_next(value: any): void {
const destination = this.destination;

if (destination.isUnsubscribed) {
this._complete();
return;
}

const index = this.index++;
if (this.active < this.concurrent) {
this.destination.next(value);
destination.next(value);
let result = tryCatch(this.project)(value, index);
if (result === errorObject) {
this.destination.error(result.e);
destination.error(result.e);
} else {
if (result._isScalar) {
this._next(result.value);
Expand Down

0 comments on commit 3b8cf94

Please sign in to comment.