From 3b147eaa492e417d562360346a4c3bddc9a90bef Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 19 Jul 2022 14:20:39 -0600 Subject: [PATCH] Make sure options are clean before trying to merge them. Fixers broken historylog. Also filter out duplicate options. --- api/js/etemplate/Et2Select/FindSelectOptions.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/Et2Select/FindSelectOptions.ts b/api/js/etemplate/Et2Select/FindSelectOptions.ts index 6f90117882..4d9212f2ed 100644 --- a/api/js/etemplate/Et2Select/FindSelectOptions.ts +++ b/api/js/etemplate/Et2Select/FindSelectOptions.ts @@ -116,8 +116,9 @@ export function find_select_options(widget, attr_options?, options : SelectOptio } if(attr_options && Object.keys(attr_options).length > 0 && content_options) { - //content_options = jQuery.extend(true, {}, attr_options, content_options); - content_options = [...attr_options, ...content_options]; + // Clean, merge and filter out duplicates + content_options = [...new Map([...cleanSelectOptions(options), ...cleanSelectOptions(content_options || [])].map(item => + [item.value, item])).values()]; } }