From 86748e6d69c2afafe0b65e8f1542242e64bd0bae Mon Sep 17 00:00:00 2001 From: Anthony Dresser Date: Fri, 6 Apr 2018 15:54:18 -0700 Subject: [PATCH] clear insights view before showing error (#1050) --- .../dashboard/widgets/insights/insightsWidget.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sql/parts/dashboard/widgets/insights/insightsWidget.component.ts b/src/sql/parts/dashboard/widgets/insights/insightsWidget.component.ts index 879c620bb1..22ec0c8421 100644 --- a/src/sql/parts/dashboard/widgets/insights/insightsWidget.component.ts +++ b/src/sql/parts/dashboard/widgets/insights/insightsWidget.component.ts @@ -187,13 +187,14 @@ export class InsightsWidget extends DashboardWidget implements IDashboardWidget, } private _updateChild(result: SimpleExecuteResult): void { + this.componentHost.viewContainerRef.clear(); + if (result.rowCount === 0) { this.showError(nls.localize('noResults', 'No results to show')); return; } let componentFactory = this._componentFactoryResolver.resolveComponentFactory(insightRegistry.getCtorFromId(this._typeKey)); - this.componentHost.viewContainerRef.clear(); let componentRef = this.componentHost.viewContainerRef.createComponent(componentFactory); let componentInstance = componentRef.instance;