Skip to content

Commit 2e30fd1

Browse files
author
Mark Buer
committed
fix(combineLatest): emit unique array instances with the default projection
1 parent 897fe3b commit 2e30fd1

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

spec/operators/combineLatest-spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,4 +461,14 @@ describe('Observable.prototype.combineLatest', () => {
461461
expectSubscriptions(e1.subscriptions).toBe(e1subs);
462462
expectSubscriptions(e2.subscriptions).toBe(e2subs);
463463
});
464+
465+
it('should emit unique array instances with the default projection', () => {
466+
const e1 = hot('-a--b--|');
467+
const e2 = hot('--1--2-|');
468+
const expected = '-------(c|)';
469+
470+
const result = e1.combineLatest(e2).distinct().count();
471+
472+
expectObservable(result).toBe(expected, { c: 3 });
473+
});
464474
});

src/operator/combineLatest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export class CombineLatestSubscriber<T, R> extends OuterSubscriber<T, R> {
150150
if (this.project) {
151151
this._tryProject(values);
152152
} else {
153-
this.destination.next(values);
153+
this.destination.next(values.slice());
154154
}
155155
}
156156
}

0 commit comments

Comments
 (0)