fix: use defaultIndex instead of 0 in transformArgs

This commit is contained in:
Bart van Andel 2025-04-05 23:01:52 +02:00
parent 7c8be12d52
commit b9ed1fde62

View file

@ -74,11 +74,11 @@ function transformArgs(opArgsList, newArgs) {
return opArgs.map((arg) => { return opArgs.map((arg) => {
if (arg.type === "option") { if (arg.type === "option") {
// pick default option if not already chosen // pick default option if not already chosen
return typeof arg.value === "string" ? arg.value : arg.value[0]; return typeof arg.value === "string" ? arg.value : arg.value[arg.defaultIndex ?? 0];
} }
if (arg.type === "editableOption") { if (arg.type === "editableOption") {
return typeof arg.value === "string" ? arg.value : arg.value[0].value; return typeof arg.value === "string" ? arg.value : arg.value[arg.defaultIndex ?? 0].value;
} }
if (arg.type === "toggleString") { if (arg.type === "toggleString") {