Fix Et2LinkSearch did not always get correct option when it was loaded with a value

SearchMixin was incorrectly allowing it as a free entry, so it wasn't being properly loaded by Et2LinkSearch
This commit is contained in:
nathan 2022-08-15 10:38:19 -06:00
parent 652e84644b
commit 6095b0e2ae
2 changed files with 2 additions and 2 deletions

View File

@ -117,7 +117,7 @@ export class Et2LinkSearch extends Et2Select
option.label = title || Et2Link.MISSING_TITLE;
option.class = "";
// It's probably already been rendered, find the item
let item = this.getItems().find(i => i.value === option.value);
let item = this.menuItems.find(i => i.value === option.value);
if(item)
{
item.textContent = title;

View File

@ -408,7 +408,7 @@ export const Et2WithSearchMixin = <T extends Constructor<LitElement>>(superclass
}
// Overridden to add options if allowFreeEntries=true
if(typeof this.value == "string" && !this._menuItems.find(o => o.value == this.value && !o.classList.contains('remote')))
if(this.allowFreeEntries && typeof this.value == "string" && !this._menuItems.find(o => o.value == this.value && !o.classList.contains('remote')))
{
this.createFreeEntry(this.value);
}