diff --git a/components/cdk/overflow/overflow-container.component.ts b/components/cdk/overflow/overflow-container.component.ts index 0f7acaeec61..c5af7575ef2 100644 --- a/components/cdk/overflow/overflow-container.component.ts +++ b/components/cdk/overflow/overflow-container.component.ts @@ -152,8 +152,8 @@ export class NzOverflowContainerComponent implements OnInit, AfterContentInit, O } ngAfterContentInit(): void { this.overflowItems?.changes.pipe(startWith(this.overflowItems)).subscribe(this.overflowItems$); - this.overflowSuffix?.suffixWidth$.subscribe(this.suffixWidth$); - this.overflowRest?.restWidth$.subscribe(this.restWidth$); + this.overflowSuffix?.suffixWidth$.pipe(takeUntil(this.destroy$)).subscribe(this.suffixWidth$); + this.overflowRest?.restWidth$.pipe(takeUntil(this.destroy$)).subscribe(this.restWidth$); this.contentInit$.next(); } ngOnDestroy(): void {