mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Refactor ensureSelectionExists for more readability
This commit is contained in:
@ -2243,7 +2243,9 @@ function ensureSelectionExists(setting, selector) {
|
|||||||
if (!selectElement) {
|
if (!selectElement) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (selectElement.selectedOptions.length && !Array.from(selectElement.options).some(option => option.value === extension_settings.sd[setting])) {
|
const options = Array.from(selectElement.options);
|
||||||
|
const value = extension_settings.sd[setting];
|
||||||
|
if (selectElement.selectedOptions.length && !options.some(option => option.value === value)) {
|
||||||
extension_settings.sd[setting] = selectElement.selectedOptions[0].value;
|
extension_settings.sd[setting] = selectElement.selectedOptions[0].value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user