From 9bcd7cdd80db62f187061b1f61a7eae10d1555a7 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Fri, 8 May 2020 15:56:59 -0700 Subject: [PATCH] Fix tabbed panel not updating correctly when layout updated (#10328) * Fix tabbed panel not updating correctly when layout updated * Add comment --- .../base/browser/ui/panel/panel.component.ts | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/sql/base/browser/ui/panel/panel.component.ts b/src/sql/base/browser/ui/panel/panel.component.ts index 3e5ea52fa7..5fc2b49b1e 100644 --- a/src/sql/base/browser/ui/panel/panel.component.ts +++ b/src/sql/base/browser/ui/panel/panel.component.ts @@ -52,18 +52,18 @@ let idPool = 0; @Component({ selector: 'panel', template: ` -
-
+
+
-
+
- + - +
{{tab.title}}
@@ -85,7 +85,16 @@ let idPool = 0; ` }) export class PanelComponent extends Disposable implements IThemable { - @Input() public options?: IPanelOptions; + private _options: IPanelOptions = defaultOptions; + + @Input() public set options(newOptions: IPanelOptions) { + // Refresh for the case when the options are set + // manually through code which doesn't trigger + // Angular's change detection + this._options = newOptions; + this._cd.detectChanges(); + } + @Input() public actions?: Array; @ContentChildren(TabComponent) private readonly _tabs!: QueryList; @ViewChildren(TabHeaderComponent) private readonly _tabHeaders!: QueryList; @@ -127,7 +136,7 @@ export class PanelComponent extends Disposable implements IThemable { } ngOnInit(): void { - this.options = mixin(this.options || {}, defaultOptions, false); + this._options = mixin(this._options || {}, defaultOptions, false); const rootContainerElement = this._rootContainer.nativeElement as HTMLElement; this._styleElement = createStyleSheet(rootContainerElement); }