From 35e0f1a99f777d4281906b90bcc594c7da377c0a Mon Sep 17 00:00:00 2001 From: Udeesha Gautam <46980425+udeeshagautam@users.noreply.github.com> Date: Fri, 30 Apr 2021 13:48:35 -0700 Subject: [PATCH] Missed commit from PR #15082 (#15302) * missed commit from PR #15082 for back up restore name update issue --- src/sql/base/browser/ui/selectBox/selectBox.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/sql/base/browser/ui/selectBox/selectBox.ts b/src/sql/base/browser/ui/selectBox/selectBox.ts index c70b2d570c..7c1b0519c1 100644 --- a/src/sql/base/browser/ui/selectBox/selectBox.ts +++ b/src/sql/base/browser/ui/selectBox/selectBox.ts @@ -216,11 +216,9 @@ export class SelectBox extends vsSelectBox { let selectOptions: SelectOptionItemSQL[] = SelectBox.createOptions(options); this.populateOptionsDictionary(selectOptions); super.setOptions(selectOptions, selected); - // Adding following since setOptions from super alone is not setting this._selectedOption - let selectedOptionIndex = this._optionsDictionary.get(this._selectedOption); - if (selectedOptionIndex === selected) { - return; - } + // Calling super.setOptions even with a value selected doesn't fire the onSelected event and doesn't update this._selectedOption, + // So manually updating it here to ensure that the value is kept in sync. + // Currently we're not firing the onDidSelect event in this case to align with the base implementation, but that can change if there's a need for that to happen if (this._dialogOptions !== undefined) { this._selectedOption = this._dialogOptions[selected]?.value; }