[SM-403] fix: manually detectChanges in Product Switcher (#4307)

This commit is contained in:
Will Martin 2022-12-22 16:36:23 -05:00 committed by GitHub
parent b1ee65dca8
commit 288827f13a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 2 deletions

View File

@ -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"; import { IconButtonType } from "@bitwarden/components/src/icon-button/icon-button.component";
@ -8,7 +8,7 @@ import { flagEnabled } from "../../../utils/flags";
selector: "product-switcher", selector: "product-switcher",
templateUrl: "./product-switcher.component.html", templateUrl: "./product-switcher.component.html",
}) })
export class ProductSwitcherComponent { export class ProductSwitcherComponent implements AfterViewInit {
protected isEnabled = flagEnabled("secretsManager"); protected isEnabled = flagEnabled("secretsManager");
/** /**
@ -16,4 +16,15 @@ export class ProductSwitcherComponent {
*/ */
@Input() @Input()
buttonType: IconButtonType = "main"; 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) {}
} }