diff --git a/src/core/mainmenu/pages/more/more.ts b/src/core/mainmenu/pages/more/more.ts index 03fc83452..c91d984bb 100644 --- a/src/core/mainmenu/pages/more/more.ts +++ b/src/core/mainmenu/pages/more/more.ts @@ -72,6 +72,8 @@ export class CoreMainMenuMorePage implements OnDestroy { */ ngOnDestroy(): void { window.removeEventListener('resize', this.initHandlers.bind(this)); + this.langObserver && this.langObserver.off(); + this.updateSiteObserver && this.updateSiteObserver.off(); if (this.subscription) { this.subscription.unsubscribe(); diff --git a/src/providers/sites.ts b/src/providers/sites.ts index 19f117a6a..b64da98fd 100644 --- a/src/providers/sites.ts +++ b/src/providers/sites.ts @@ -27,6 +27,7 @@ import { CoreConfigConstants } from '../configconstants'; import { CoreSite } from '@classes/site'; import { SQLiteDB, SQLiteDBTableSchema } from '@classes/sqlitedb'; import { Md5 } from 'ts-md5/dist/md5'; +import { Location } from '@angular/common'; /** * Response of checking if a site exists and its configuration. @@ -320,7 +321,7 @@ export class CoreSitesProvider { constructor(logger: CoreLoggerProvider, private http: HttpClient, private sitesFactory: CoreSitesFactoryProvider, private appProvider: CoreAppProvider, private translate: TranslateService, private urlUtils: CoreUrlUtilsProvider, - private eventsProvider: CoreEventsProvider, private textUtils: CoreTextUtilsProvider, + private eventsProvider: CoreEventsProvider, private textUtils: CoreTextUtilsProvider, private location: Location, private utils: CoreUtilsProvider) { this.logger = logger.getInstance('CoreSitesProvider'); @@ -1161,6 +1162,9 @@ export class CoreSitesProvider { promises.push(this.appDB.deleteRecords(this.CURRENT_SITE_TABLE, { id: 1 })); return Promise.all(promises).finally(() => { + // Due to DeepLinker, we need to remove the path from the URL, otherwise some pages are re-created when they shouldn't. + this.location.replaceState(''); + this.eventsProvider.trigger(CoreEventsProvider.LOGOUT, {}, siteId); }); }