Improve performance on fancy key selector init

This commit is contained in:
Wolfsblvt
2024-08-05 01:06:37 +02:00
parent 4966139fd1
commit 3523ec334d
2 changed files with 12 additions and 7 deletions

View File

@@ -2293,6 +2293,9 @@ function getWorldEntry(name, data, entry) {
}
if (isFancyInput) {
// First initialize existing values as options, before initializing select2, to speed up performance
select2ModifyOptions(input, entry[entryPropName], { select: true, changeEventArgs: { skipReset: true, noSave: true } });
input.select2({
ajax: dynamicSelect2DataViaAjax(() => worldEntryKeyOptionsCache),
tags: true,
@@ -2334,8 +2337,6 @@ function getWorldEntry(name, data, entry) {
input.next('span.select2-container').find('textarea')
.val(key).trigger('input');
}, { openDrawer: true });
select2ModifyOptions(input, entry[entryPropName], { select: true, changeEventArgs: { skipReset: true, noSave: true } });
}
else {
// Compatibility with mobile devices. On mobile we need a text input field, not a select option control, so we need its own event handlers