untilDestroyed(this)) not working on route change
See original GitHub issueI just trying to unsubscribe on route change but its not working
@UntilDestroy({ checkProperties: true })
@Component({
.
.
.
changeDetection: ChangeDetectionStrategy.OnPush
})
ngOnInit(): void {
interval(1000)
.pipe(untilDestroyed(this))
.subscribe((count) => {
console.log('count:', count);
});
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:11
Top Results From Across the Web
akita-state-management/Lobby - Gitter
I recently added persistState to main.ts in my app, but unfortunately started seeing issues related to zones and change detection. I'm wondering you...
Read more >Angular/RxJS When should I unsubscribe from `Subscription`
I tried seangwright's solution (Edit 3). That is not working for Observable that created by timer or interval.
Read more >[4+1 ways] How to Unsubscribe from Observables in Angular ...
Our code seems to work! BUT, what would happen if we destroy this component (e.g by navigating to an other route that doesn't...
Read more >@ngneat/until-destroy | Yarn - Package Manager
... @UntilDestroy() @Component({}) export class InboxComponent { ngOnInit() { interval(1000).pipe(untilDestroyed(this)).subscribe(); } }.
Read more >Auto Unsubscribing From Observables On NgDestroy
A common pattern when working with observables/subjects inside an Angular Component, is to store the subscriptions in a list, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve published
@ngneat/until-destroy@8.0.2
with updated readme.@arturovt I agree with @Smip , this should be added to the readme. We have lots of warnings when doing npm install and these can be easily missed. Just lost an hour+ trying to find out what’s going on.