From 4f495eceb6a953952f6e1985ee806bf3b3d4947a Mon Sep 17 00:00:00 2001 From: Ivan Efimov Date: Thu, 6 Oct 2022 23:31:48 -0500 Subject: [PATCH] Presets bugfix: automatically preselect current FC firmware version in the search dropdown --- src/tabs/presets/presets.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/tabs/presets/presets.js b/src/tabs/presets/presets.js index ca5a296d..f5e89656 100644 --- a/src/tabs/presets/presets.js +++ b/src/tabs/presets/presets.js @@ -335,13 +335,16 @@ presets.multipleSelectComponentScrollFix = function() { when the number of items 199+. More details here: https://github.com/wenzhixin/multiple-select/issues/552 */ + return new Promise((resolve) => { GUI.timeout_add('hack_fix_multipleselect_scroll', () => { this._selectCategory.multipleSelect('refresh'); this._selectKeyword.multipleSelect('refresh'); this._selectAuthor.multipleSelect('refresh'); this._selectFirmwareVersion.multipleSelect('refresh'); this._selectStatus.multipleSelect('refresh'); + resolve(); }, 100); + }); }; presets.checkPresetSourceVersion = function() { @@ -375,14 +378,12 @@ presets.prepareFilterFields = function() { this.prepareFilterSelectField(this._selectAuthor, this.presetsRepo.index.uniqueValues.author, 1); this.prepareFilterSelectField(this._selectFirmwareVersion, this.presetsRepo.index.uniqueValues.firmware_version, 2); this.prepareFilterSelectField(this._selectStatus, this.presetsRepo.index.settings.PresetStatusEnum, 2); - this.multipleSelectComponentScrollFix(); - - this.preselectFilterFields(); - this._inputTextFilter.on('input', () => this.updateSearchResults()); - - this._freezeSearch = false; - - this.updateSearchResults(); + this.multipleSelectComponentScrollFix().then(() => { + this.preselectFilterFields(); + this._inputTextFilter.on('input', () => this.updateSearchResults()); + this._freezeSearch = false; + this.updateSearchResults(); + }); }; presets.preselectFilterFields = function() {