From a9f1b693ad30ec5b7f6c05514d5012b37ae4526c Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 29 Nov 2023 10:42:57 -0700 Subject: [PATCH] Et2SelectAccount: Fix initial values not always displayed when options are from server or file --- api/js/etemplate/Et2Select/SelectAccountMixin.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/Et2Select/SelectAccountMixin.ts b/api/js/etemplate/Et2Select/SelectAccountMixin.ts index f83a6f62ea..03b0756bf9 100644 --- a/api/js/etemplate/Et2Select/SelectAccountMixin.ts +++ b/api/js/etemplate/Et2Select/SelectAccountMixin.ts @@ -85,7 +85,8 @@ export const SelectAccountMixin = >(superclass } let account_name = null; - let option = {value: "" + id, label: id + " ..."}; + const tempLabel = id + " ..." + let option = {value: "" + id, label: tempLabel}; this.account_options.push(option); if(this.value && (account_name = this.egw().link_title('api-accounts', id, false))) { @@ -97,7 +98,16 @@ export const SelectAccountMixin = >(superclass this.egw().link_title('api-accounts', id, true).then(title => { option.label = title || ''; - this.requestUpdate('select_options'); + this.requestUpdate(); + + // Directly update if it's already there + const slOption = this.select?.querySelector('[value="' + id + '"]'); + if(slOption) + { + // Replace instead of changing the whole thing to preserve LitElement marker comments + slOption.textContent.replace(tempLabel, title); + this.select.requestUpdate("value"); + } }); } }