fix: unsubscribe streamItems on deinit (#453)
This commit is contained in:
@@ -13,6 +13,7 @@ export class PreferencesManager extends ApplicationService {
|
|||||||
|
|
||||||
private userPreferences!: SNUserPrefs
|
private userPreferences!: SNUserPrefs
|
||||||
private loadingPrefs = false;
|
private loadingPrefs = false;
|
||||||
|
private unubscribeStreamItems?: () => void;
|
||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
async onAppLaunch() {
|
async onAppLaunch() {
|
||||||
@@ -21,12 +22,16 @@ export class PreferencesManager extends ApplicationService {
|
|||||||
this.streamPreferences();
|
this.streamPreferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deinit() {
|
||||||
|
this.unubscribeStreamItems && this.unubscribeStreamItems();
|
||||||
|
}
|
||||||
|
|
||||||
get webApplication() {
|
get webApplication() {
|
||||||
return this.application as WebApplication;
|
return this.application as WebApplication;
|
||||||
}
|
}
|
||||||
|
|
||||||
streamPreferences() {
|
streamPreferences() {
|
||||||
this.application!.streamItems(
|
this.unubscribeStreamItems = this.application!.streamItems(
|
||||||
ContentType.UserPrefs,
|
ContentType.UserPrefs,
|
||||||
() => {
|
() => {
|
||||||
this.reloadSingleton();
|
this.reloadSingleton();
|
||||||
|
|||||||
Reference in New Issue
Block a user