rxjs icon indicating copy to clipboard operation
rxjs copied to clipboard

Concat behavior change between versions 6.5.4 and 7.5.5.

Open CaffeinatedCodeMonkey opened this issue 2 years ago • 0 comments

Describe the bug

I recently updated my version RxJS from 6.5.4 to 7.5.5 and started coming across issues in my unit tests. I eventually narrowed it down to something in concat. In 6.5.4, if a root observable was shared between the first and second param of concat, the observable would not complete during the transition. This is not the case in 7.5.5, and I have not found documentation that outlines a breaking change.

Expected behavior

I expected the shared root observable to survive the transition between subscriptions in the concat.

Reproduction code

import { race, of, concat, Subject, interval } from 'rxjs';
import { map, delay, take, share, finalize } from 'rxjs/operators';
const sub = new Subject();
const myRootObservable = sub.pipe(
  finalize(() => console.log('I completed')),
  share()
);
const myFirstObservable = myRootObservable.pipe(map(() => 1));
const mySecondObservable = myRootObservable.pipe(map(() => 2));

concat(myFirstObservable.pipe(take(1)), mySecondObservable).subscribe(
  console.log
);
sub.next();

Reproduction URL

https://stackblitz.com/edit/rxjs-bhfcss?file=index.ts

Version

6.5.4 and 7.5.5

Environment

No response

Additional context

No response

CaffeinatedCodeMonkey avatar May 24 '22 16:05 CaffeinatedCodeMonkey