MOBILE-4081 addons: Delete manager instances

This prevents errors for trying to get the source of a destroyed manager (for example, for subsequent asynchronous calls fetching data).
main
Noel De Martin 2022-11-24 12:38:38 +01:00
parent 61f8d8c242
commit c94785a94f
3 changed files with 9 additions and 3 deletions

View File

@ -340,7 +340,9 @@ export class AddonCalendarCalendarComponent implements OnInit, DoCheck, OnDestro
ngOnDestroy(): void {
this.undeleteEventObserver?.off();
this.manager?.destroy();
this.managerUnsubscribe && this.managerUnsubscribe();
this.managerUnsubscribe?.();
delete this.manager;
}
}

View File

@ -457,7 +457,9 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
this.filterChangedObserver?.off();
this.manager?.getSource().forgetRelatedSources();
this.manager?.destroy();
this.managerUnsubscribe && this.managerUnsubscribe();
this.managerUnsubscribe?.();
delete this.manager;
}
}

View File

@ -314,8 +314,10 @@ export class AddonModBookContentsPage implements OnInit, OnDestroy {
* @inheritdoc
*/
ngOnDestroy(): void {
this.managerUnsubscribe && this.managerUnsubscribe();
this.manager?.destroy();
this.managerUnsubscribe?.();
delete this.manager;
}
}