From cc4813ea90e7a6b8a7cbe154fd5ec66da848b21c Mon Sep 17 00:00:00 2001 From: ralf Date: Fri, 1 Dec 2023 16:58:25 +0200 Subject: [PATCH] Revert "SearchMixin: Fix initial values not always displayed when options are from server or file" Causes a complete browser freeze when opening Preferences > Common preferences > Default preferences This reverts commit 562a39157975570b59e3e080a609dfb05b44f251. --- api/js/etemplate/Et2Select/SearchMixin.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/api/js/etemplate/Et2Select/SearchMixin.ts b/api/js/etemplate/Et2Select/SearchMixin.ts index 3b266bff7b..64b37eb557 100644 --- a/api/js/etemplate/Et2Select/SearchMixin.ts +++ b/api/js/etemplate/Et2Select/SearchMixin.ts @@ -633,13 +633,12 @@ export const Et2WithSearchMixin = dedupeMixin( // Given a value we need to search for - this will add in all matches, including the one needed this.remoteSearch(newValueElement, this.searchOptions).then((result : SelectOption[]) => { - // Re-set / update value since SlSelect probably removed it by now due to missing option - if(typeof this.select != "undefined") + const option = result.find(o => o.value == newValueElement); + if(option && !this._selected_remote.some(o => o.value == newValueElement)) { - this.select.value = this.shoelaceValue ?? this.value; - this.select.requestUpdate("value"); + this._selected_remote.push(option); } - this.requestUpdate("value"); + this.requestUpdate(); }); }