From e1e772b0a28750db789a9c71be90290c19708268 Mon Sep 17 00:00:00 2001 From: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com> Date: Thu, 19 Sep 2024 13:39:16 -0400 Subject: [PATCH] =?UTF-8?q?PM-12365=20-=20AnonLayoutWrapperComp=20-=20When?= =?UTF-8?q?=20you=20use=20the=20AnonLayoutWrapperDataService=20to=20set=20?= =?UTF-8?q?data=20in=20the=20AnonLayoutWrapperComponent,=20I=E2=80=99m=20s?= =?UTF-8?q?eeing=20an=20ExpressionChangedAfterItHasBeenCheckedError=20show?= =?UTF-8?q?n=20in=20the=20console=20quite=20often.=20We=20should=20update?= =?UTF-8?q?=20the=20wrapper=20component=20to=20fire=20change=20detection?= =?UTF-8?q?=20if=20the=20AnonLayoutWrapperDataService=20receives=20new=20i?= =?UTF-8?q?nformation.=20(#11136)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../angular/anon-layout/anon-layout-wrapper.component.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/auth/src/angular/anon-layout/anon-layout-wrapper.component.ts b/libs/auth/src/angular/anon-layout/anon-layout-wrapper.component.ts index 84a9b4bcf86..5272342da1d 100644 --- a/libs/auth/src/angular/anon-layout/anon-layout-wrapper.component.ts +++ b/libs/auth/src/angular/anon-layout/anon-layout-wrapper.component.ts @@ -1,4 +1,4 @@ -import { Component, OnDestroy, OnInit } from "@angular/core"; +import { ChangeDetectorRef, Component, OnDestroy, OnInit } from "@angular/core"; import { ActivatedRoute, Data, NavigationEnd, Router, RouterModule } from "@angular/router"; import { Subject, filter, switchMap, takeUntil, tap } from "rxjs"; @@ -40,6 +40,7 @@ export class AnonLayoutWrapperComponent implements OnInit, OnDestroy { private route: ActivatedRoute, private i18nService: I18nService, private anonLayoutWrapperDataService: AnonLayoutWrapperDataService, + private changeDetectorRef: ChangeDetectorRef, ) {} ngOnInit(): void { @@ -122,6 +123,10 @@ export class AnonLayoutWrapperComponent implements OnInit, OnDestroy { if (data.showReadonlyHostname != null) { this.showReadonlyHostname = data.showReadonlyHostname; } + + // Manually fire change detection to avoid ExpressionChangedAfterItHasBeenCheckedError + // when setting the page data from a service + this.changeDetectorRef.detectChanges(); } private resetPageData() {