From 288827f13a68cf92ecc8c38442cacbb24e42458f Mon Sep 17 00:00:00 2001 From: Will Martin Date: Thu, 22 Dec 2022 16:36:23 -0500 Subject: [PATCH] [SM-403] fix: manually detectChanges in Product Switcher (#4307) --- .../product-switcher.component.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/web/src/app/layouts/product-switcher/product-switcher.component.ts b/apps/web/src/app/layouts/product-switcher/product-switcher.component.ts index 60c028320e..a461785c31 100644 --- a/apps/web/src/app/layouts/product-switcher/product-switcher.component.ts +++ b/apps/web/src/app/layouts/product-switcher/product-switcher.component.ts @@ -1,4 +1,4 @@ -import { Component, Input } from "@angular/core"; +import { AfterViewInit, ChangeDetectorRef, Component, Input } from "@angular/core"; import { IconButtonType } from "@bitwarden/components/src/icon-button/icon-button.component"; @@ -8,7 +8,7 @@ import { flagEnabled } from "../../../utils/flags"; selector: "product-switcher", templateUrl: "./product-switcher.component.html", }) -export class ProductSwitcherComponent { +export class ProductSwitcherComponent implements AfterViewInit { protected isEnabled = flagEnabled("secretsManager"); /** @@ -16,4 +16,15 @@ export class ProductSwitcherComponent { */ @Input() buttonType: IconButtonType = "main"; + + ngAfterViewInit() { + /** + * Resolves https://angular.io/errors/NG0100 [SM-403] + * + * Caused by `[bitMenuTriggerFor]="content?.menu"` in template + */ + this.changeDetector.detectChanges(); + } + + constructor(private changeDetector: ChangeDetectorRef) {} }