From 751942728d64fac7ba6c6e1373578de7653fcd7a Mon Sep 17 00:00:00 2001 From: ralf Date: Sat, 2 Dec 2023 19:36:28 +0200 Subject: [PATCH] Revert "Revert "SearchMixin: Fix initial values not always displayed when options are from server or file"" This reverts commit cc4813ea90e7a6b8a7cbe154fd5ec66da848b21c. --- api/js/etemplate/Et2Select/SearchMixin.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/api/js/etemplate/Et2Select/SearchMixin.ts b/api/js/etemplate/Et2Select/SearchMixin.ts index 64b37eb557..3b266bff7b 100644 --- a/api/js/etemplate/Et2Select/SearchMixin.ts +++ b/api/js/etemplate/Et2Select/SearchMixin.ts @@ -633,12 +633,13 @@ 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[]) => { - const option = result.find(o => o.value == newValueElement); - if(option && !this._selected_remote.some(o => o.value == newValueElement)) + // Re-set / update value since SlSelect probably removed it by now due to missing option + if(typeof this.select != "undefined") { - this._selected_remote.push(option); + this.select.value = this.shoelaceValue ?? this.value; + this.select.requestUpdate("value"); } - this.requestUpdate(); + this.requestUpdate("value"); }); }