Refactor ensureSelectionExists for more readability

ab966db1e5ae9a7a6248314fd55529789f342b0e

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +3 -1Ignore whitespace
public/scripts/extensions/stable-diffusion/index.js+3 -1
@@ -2243,7 +2243,9 @@ function ensureSelectionExists(setting, selector) {
2243 if (!selectElement) {2243 if (!selectElement) {
2244 return;2244 return;
2245 }2245 }
2246 if (selectElement.selectedOptions.length && !Array.from(selectElement.options).some(option => option.value === extension_settings.sd[setting])) {2246 const options = Array.from(selectElement.options);
2247 const value = extension_settings.sd[setting];
2248 if (selectElement.selectedOptions.length && !options.some(option => option.value === value)) {
2247 extension_settings.sd[setting] = selectElement.selectedOptions[0].value;2249 extension_settings.sd[setting] = selectElement.selectedOptions[0].value;
2248 }2250 }
2249}2251}