mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-01-05 13:36:47 +01:00
Refactor ensureSelectionExists for more readability
This commit is contained in:
parent
42d24dbc47
commit
ab966db1e5
@ -2243,7 +2243,9 @@ function ensureSelectionExists(setting, selector) {
|
||||
if (!selectElement) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user