Closed sonyz closed 3 years ago
I had the same problem on an app after migrating to Angular 9 (if I am not mistaken). @sinedied wdyt of using the ngneat/until-destroy plugin?
I think the workaround is to add the dependency to this plugin and to not use the until-destroy in the package for moment.
@luiza-cicone when I wrote the initial version of untilDestroyed, the available version of until-destroy package has some issues, and it fell dumb to add a dependency for a few lines of codes. But it seems that it's now more complex than that with the new Ivy engine, so it's time to migrate and use the better version 👍
:tada: This issue has been resolved in version 9.2.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
I'm submitting a...
Current behavior
The UntilDestroyed on Observable is not working. In the ngOnDestroy(), the method is not called correctly.
Expected behavior
The observable must be "destroyed" when ngOnDestroy is automatically called.
Minimal reproduction of the problem with instructions
ngOnInit(): void { let number = Math.floor(Math.random() 100); // Init scheduled calls to operation statuses interval(5 1000) .pipe(startWith(0)) .pipe(untilDestroyed(this)) .subscribe(() => { console.log('test', number); }); }
ngOnDestroy(): void { console.log('destroyed'); }
The 'destroyed' log is correctly displayed but the observable still exists.
Environment
Others: