ckeditor / ckeditor4-angular

Official CKEditor 4 Angular component.
Other
55 stars 32 forks source link

Fix the problem on destroy happening to fast #111

Closed bhugot closed 4 years ago

bhugot commented 4 years ago

The problem is visible in #110

bhugot commented 4 years ago

Could be fixing also #38

bhugot commented 4 years ago

About the #38 as we don't even call create editor we should not have this problem

bhugot commented 4 years ago

Be aware that there is still a case where it will be failling if the component is in a ng-content as the ngOnDrestroy is not called https://stackblitz.com/edit/angular-ivy-jvybwy?file=src%2Fapp%2Fapp.component.html

f1ames commented 4 years ago

@ezintz Thank you for checking this PR!

Be aware that there is still a case where it will be failling if the component is in a ng-content as the ngOnDrestroy is not called https://stackblitz.com/edit/angular-ivy-jvybwy?file=src%2Fapp%2Fapp.component.html

@bhugot can you elaborate more on this one? I don't see any errors in your code sample (nor CKEditor component)?

bhugot commented 4 years ago

this example only show that when you have a as parent of another component then even if not displayed the ngOnInit is call (look in console log 'Child initialized') but the onDestroy is not call. That can lead on error with CKEditor (it's not an issue with ckeditor-angular) just for reference if someone has this issue sometime after this PR is merged

f1ames commented 4 years ago

this example only show that when you have a as parent of another component then even if not displayed the ngOnInit is call (look in console log 'Child initialized') but the onDestroy is not call. That can lead on error with CKEditor (it's not an issue with ckeditor-angular) just for reference if someone has this issue sometime after this PR is merged

Thanks for the clarification @bhugot :+1: So it seems this is an issue in Angular itself (btw. do you have any number/reference to this issue, was it reported somewhere)?

Do you know any workaround for this issue so we can keep it for future reference?

bhugot commented 4 years ago

An issue on this : https://github.com/angular/angular/issues/18982 One way to handle it, is to use a ng-template so the template is only used when is parent is visible

f1ames commented 4 years ago

Rebased onto latest master.

bhugot commented 4 years ago

You're welcome