From 98d9f639f7b8a99094cbf3a9a4b2dd25eaf7b96c Mon Sep 17 00:00:00 2001 From: Michael Spalti Date: Mon, 6 May 2024 16:19:03 -0700 Subject: [PATCH] Updated browser init to update cache after external auth. --- src/modules/app/browser-init.service.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/modules/app/browser-init.service.ts b/src/modules/app/browser-init.service.ts index bf40f0c68b..3704892e6e 100644 --- a/src/modules/app/browser-init.service.ts +++ b/src/modules/app/browser-init.service.ts @@ -30,9 +30,11 @@ import { filter, find, map } from 'rxjs/operators'; import { isNotEmpty } from '../../app/shared/empty.util'; import { logStartupMessage } from '../../../startup-message'; import { MenuService } from '../../app/shared/menu/menu.service'; +import { RequestService } from '../../app/core/data/request.service'; import { RootDataService } from '../../app/core/data/root-data.service'; import { firstValueFrom, Subscription } from 'rxjs'; import { ServerCheckGuard } from '../../app/core/server-check/server-check.guard'; +import { HALEndpointService } from '../../app/core/shared/hal-endpoint.service'; /** * Performs client-side initialization. @@ -59,6 +61,8 @@ export class BrowserInitService extends InitService { protected menuService: MenuService, private rootDataService: RootDataService, protected serverCheckGuard: ServerCheckGuard, + private requestService: RequestService, + private halService: HALEndpointService, ) { super( store, @@ -145,17 +149,15 @@ export class BrowserInitService extends InitService { } /** - * During an external authentication flow invalidate the SSR transferState + * During an external authentication flow invalidate the * data in the cache. This allows the app to fetch fresh content. * @private */ private externalAuthCheck() { - this.sub = this.authService.isExternalAuthentication().pipe( filter((externalAuth: boolean) => externalAuth) ).subscribe(() => { - // Clear the transferState data. - this.rootDataService.invalidateRootCache(); + this.requestService.setStaleByHrefSubstring(this.halService.getRootHref()); this.authService.setExternalAuthStatus(false); } );