Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(module:radio, tab): Fixed memory leak problem. #3354

Merged
merged 2 commits into from
Apr 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion components/radio/nz-radio.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
HostListener,
Input,
OnChanges,
OnDestroy,
Renderer2,
SimpleChanges,
ViewChild,
Expand Down Expand Up @@ -46,7 +47,7 @@ import { InputBoolean } from 'ng-zorro-antd/core';
'[class.ant-radio-wrapper-disabled]': 'nzDisabled'
}
})
export class NzRadioComponent implements ControlValueAccessor, AfterViewInit, OnChanges {
export class NzRadioComponent implements ControlValueAccessor, AfterViewInit, OnChanges, OnDestroy {
select$ = new Subject<NzRadioComponent>();
touched$ = new Subject<void>();
checked = false;
Expand Down Expand Up @@ -140,4 +141,8 @@ export class NzRadioComponent implements ControlValueAccessor, AfterViewInit, On
this.updateAutoFocus();
}
}

ngOnDestroy(): void {
this.focusMonitor.stopMonitoring(this.elementRef);
}
}
9 changes: 8 additions & 1 deletion components/tabs/nz-tabs-nav.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
EventEmitter,
Input,
NgZone,
OnDestroy,
Optional,
Output,
QueryList,
Expand Down Expand Up @@ -47,7 +48,7 @@ export type ScrollDirection = 'after' | 'before';
encapsulation: ViewEncapsulation.None,
templateUrl: './nz-tabs-nav.component.html'
})
export class NzTabsNavComponent implements AfterContentChecked, AfterContentInit {
export class NzTabsNavComponent implements AfterContentChecked, AfterContentInit, OnDestroy {
private _tabPositionMode: NzTabPositionMode = 'horizontal';
private _scrollDistance = 0;
private _selectedIndex = 0;
Expand Down Expand Up @@ -174,6 +175,12 @@ export class NzTabsNavComponent implements AfterContentChecked, AfterContentInit
});
}

ngOnDestroy(): void {
if (this.realignInkBar) {
this.realignInkBar.unsubscribe();
}
}

updateTabScrollPosition(): void {
const scrollDistance = this.scrollDistance;
if (this.nzPositionMode === 'horizontal') {
Expand Down