-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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:upload): ensure i18n$ is defined on unsubscribe #5971
Conversation
This preview will be available after the AzureCI is passed. |
Codecov Report
@@ Coverage Diff @@
## master #5971 +/- ##
==========================================
- Coverage 89.96% 89.96% -0.01%
==========================================
Files 465 465
Lines 14047 14046 -1
Branches 2311 2308 -3
==========================================
- Hits 12638 12636 -2
- Misses 859 862 +3
+ Partials 550 548 -2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution, could you modify it like the following? Just like the other components.
import { takeUntil } from 'rxjs/operators';
class NzUploadComponent {
private destroy$ = new Subject<void>();
ngOnInit(): void {
this.i18n.localeChange.pipe(takeUntil(this.destroy$)).subscribe(() => {
this.locale = this.i18n.getLocaleData('Upload');
this.detectChangesList();
});
}
ngOnDestroy(): void {
this.destroy$.next();
this.destroy$.complete();
}
}
done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
if the upload component is destroyed before the
ngOnInit
call, I got the following error:Cannot read property 'unsubscribe' of undefined at NzUploadComponent.ngOnDestroy
What is the new behavior?
Does this PR introduce a breaking change?
Other information