diff --git a/app/assets/javascripts/services/preferencesManager.ts b/app/assets/javascripts/services/preferencesManager.ts index e70b4df02..88336b284 100644 --- a/app/assets/javascripts/services/preferencesManager.ts +++ b/app/assets/javascripts/services/preferencesManager.ts @@ -13,6 +13,7 @@ export class PreferencesManager extends ApplicationService { private userPreferences!: SNUserPrefs private loadingPrefs = false; + private unubscribeStreamItems?: () => void; /** @override */ async onAppLaunch() { @@ -20,13 +21,17 @@ export class PreferencesManager extends ApplicationService { this.reloadSingleton(); this.streamPreferences(); } + + deinit() { + this.unubscribeStreamItems && this.unubscribeStreamItems(); + } get webApplication() { return this.application as WebApplication; } streamPreferences() { - this.application!.streamItems( + this.unubscribeStreamItems = this.application!.streamItems( ContentType.UserPrefs, () => { this.reloadSingleton();