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 562a391579.
This commit is contained in:
ralf 2023-12-01 16:58:25 +02:00
parent d5d614c1fc
commit cc4813ea90

View File

@ -633,13 +633,12 @@ export const Et2WithSearchMixin = dedupeMixin(<T extends Constructor<LitElement>
// 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 = <SelectOption>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();
});
}