Closed
Description
What is the expected behavior?
On window resize, all the observers are called.
What is the current behavior?
On window resize, the last observer is not called when one of the previous subscription is preceded by a take(1).
What are the steps to reproduce?
https://stackblitz.com/edit/angular-cdk-v7-breakpointobserver-take1-issue
Code:
const breakpoint = this.breakpointObserver.observe([Breakpoints.Small, Breakpoints.Tablet]);
breakpoint.subscribe(value => console.log('1'));
breakpoint.pipe(take(1)).subscribe(value => console.log('2'));
breakpoint.subscribe(value => console.log('3'));
breakpoint.subscribe(value => console.log('4')); // Issue: This observer is not executed on resize due to the pipe(take(1)) done for the second subscription
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
@angular/cdk 7+
Is there anything else we should know?
Works in v6: https://stackblitz.com/edit/angular-cdk-v6-breakpointobserver-take1-no-issue