diff --git a/src/core/features/login/pages/reconnect/reconnect.ts b/src/core/features/login/pages/reconnect/reconnect.ts index 999e63786..03d2958cb 100644 --- a/src/core/features/login/pages/reconnect/reconnect.ts +++ b/src/core/features/login/pages/reconnect/reconnect.ts @@ -144,6 +144,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy { { config: this.siteConfig, loginSuccessful: this.loginSuccessful, + siteId: this.siteId, }, this.siteId, ); @@ -180,7 +181,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy { if (!this.eventThrown && !this.viewLeft) { this.eventThrown = true; - CoreEvents.trigger(CoreEvents.LOGIN_SITE_CHECKED, { config: this.siteConfig }); + CoreEvents.trigger(CoreEvents.LOGIN_SITE_CHECKED, { config: this.siteConfig, siteId: this.siteId }); } this.isBrowserSSO = CoreLoginHelper.isSSOLoginNeeded(this.siteConfig.typeoflogin); diff --git a/src/core/features/styles/services/styles.ts b/src/core/features/styles/services/styles.ts index 67ea5f19a..a62ee264e 100644 --- a/src/core/features/styles/services/styles.ts +++ b/src/core/features/styles/services/styles.ts @@ -148,8 +148,15 @@ export class CoreStylesService { this.removeSite(site.getId()); }); - // Load temporary styles when site config is checked in login. + // Load temporary styles when site config is checked in login/reconnect. CoreEvents.on(CoreEvents.LOGIN_SITE_CHECKED, (data) => { + if (data.siteId) { + // Reconnecting to a site, enable the site styles. + this.enableSiteStyles(data.siteId); + + return; + } + this.loadTmpStyles(data.config).catch((error) => { this.logger.error('Error loading tmp styles', error); }); @@ -163,8 +170,9 @@ export class CoreStylesService { return; } - // The tmp styles are from a site that wasn't added in the end. Just remove them. + // User didn't access the site, unload tmp styles and site styles if any. this.unloadTmpStyles(); + this.clear(); }); } diff --git a/src/core/singletons/events.ts b/src/core/singletons/events.ts index cc8eab779..340ec0319 100644 --- a/src/core/singletons/events.ts +++ b/src/core/singletons/events.ts @@ -428,6 +428,7 @@ export type CoreEventActivityDataSentData = { */ export type CoreEventLoginSiteCheckedData = { config: CoreSitePublicConfigResponse; + siteId?: string; }; /** @@ -436,6 +437,7 @@ export type CoreEventLoginSiteCheckedData = { export type CoreEventLoginSiteUncheckedData = { config?: CoreSitePublicConfigResponse; loginSuccessful: boolean; + siteId?: string; }; /**