Skip to content

Commit

Permalink
Revert "fix(find): force unsubscribe when it completes or errors (#2550
Browse files Browse the repository at this point in the history
…)" (#2607)

This reverts commit df78c4c.
  • Loading branch information
benlesh authored Jun 14, 2017
1 parent 380fbcf commit ca50240
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 46 deletions.
16 changes: 0 additions & 16 deletions spec/helpers/doNotUnsubscribe.ts

This file was deleted.

28 changes: 0 additions & 28 deletions spec/operators/find-spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {expect} from 'chai';
import * as Rx from '../../dist/cjs/Rx';
import marbleTestingSignature = require('../helpers/marble-testing'); // tslint:disable-line:no-require-imports
import { doNotUnsubscribe } from '../helpers/doNotUnsubscribe';

declare const { asDiagram };
declare const hot: typeof marbleTestingSignature.hot;
Expand Down Expand Up @@ -163,33 +162,6 @@ describe('Observable.prototype.find', () => {
expectSubscriptions(source.subscriptions).toBe(subs);
});

it('should unsubscribe from source when complete, even if following operator does not unsubscribe', () => {
const values = {a: 3, b: 9, c: 15, d: 20};
const source = hot('---a--b--c--d---|', values);
const subs = '^ ! ';
const expected = '---------(c|) ';

const predicate = function (x) { return x % 5 === 0; };

expectObservable((<any>source).find(predicate).let(doNotUnsubscribe)).toBe(expected, values);
expectSubscriptions(source.subscriptions).toBe(subs);
});

it('should unsubscribe from source when predicate function errors,' +
' even if followring operator does not unsubscribe', () => {

const source = hot('--a--b--c--|');
const subs = '^ !';
const expected = '--#';

const predicate = function (value) {
throw 'error';
};

expectObservable((<any>source).find(predicate).let(doNotUnsubscribe)).toBe(expected);
expectSubscriptions(source.subscriptions).toBe(subs);
});

it('should support type guards without breaking previous behavior', () => {
// tslint:disable no-unused-variable

Expand Down
2 changes: 0 additions & 2 deletions src/operator/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export class FindValueSubscriber<T> extends Subscriber<T> {

destination.next(value);
destination.complete();
this.unsubscribe();
}

protected _next(value: T): void {
Expand All @@ -98,7 +97,6 @@ export class FindValueSubscriber<T> extends Subscriber<T> {
}
} catch (err) {
this.destination.error(err);
this.unsubscribe();
}
}

Expand Down

0 comments on commit ca50240

Please sign in to comment.