From d62068025cd2fe896fb516e58212b9e92210c669 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Tue, 16 Apr 2019 13:32:52 -0700 Subject: [PATCH] Merge fix the selectbox issue for chart --- src/sql/parts/query/editor/charting/chartView.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/sql/parts/query/editor/charting/chartView.ts b/src/sql/parts/query/editor/charting/chartView.ts index fbb0e624c4..f64f9b51e8 100644 --- a/src/sql/parts/query/editor/charting/chartView.ts +++ b/src/sql/parts/query/editor/charting/chartView.ts @@ -20,7 +20,7 @@ import { Taskbar } from 'sql/base/browser/ui/taskbar/taskbar'; import { ChartType } from 'sql/parts/dashboard/widgets/insights/views/charts/interfaces'; import { Registry } from 'vs/platform/registry/common/platform'; import { Dimension, $, getContentHeight, getContentWidth } from 'vs/base/browser/dom'; -import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox'; +import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox'; import { IContextViewService, IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox'; import { Builder } from 'sql/base/browser/builder'; @@ -211,8 +211,13 @@ export class ChartView extends Disposable implements IPanelView { } private buildOptions() { - dispose(this.optionDisposables); - this.optionDisposables = []; + // The first element in the disposables list is for the chart type: the master dropdown that controls other option controls. + // whiling rebuilding the options we should not dispose it, otherwise it would react to the theme change event + if (this.optionDisposables.length > 1) { + dispose(this.optionDisposables.slice(1)); + this.optionDisposables.splice(1); + } + this.optionMap = { 'type': this.optionMap['type'] }; @@ -284,7 +289,7 @@ export class ChartView extends Disposable implements IPanelView { }; break; case ControlType.combo: - let dropdown = new SelectBox(option.displayableOptions || option.options, 0, this._contextViewService); + let dropdown = new SelectBox(option.displayableOptions || option.options, undefined, this._contextViewService); dropdown.select(option.options.indexOf(value)); dropdown.render(optionContainer); dropdown.onDidSelect(e => {