Skip to content

Commit 1d798ea

Browse files
committed
chore: cleanup
1 parent 4209d7d commit 1d798ea

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

site/src/modules/workspaces/DynamicParameter/DynamicParameter.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ const ParameterField: FC<ParameterFieldProps> = ({
232232
);
233233

234234
case "multi-select": {
235-
const values = parseStringArrayValue(value);
235+
const values = parseStringArrayValue(value ?? "");
236236

237237
// Map parameter options to MultiSelectCombobox options format
238238
const options: Option[] = parameter.options.map((opt) => ({
@@ -277,7 +277,7 @@ const ParameterField: FC<ParameterFieldProps> = ({
277277
}
278278

279279
case "tag-select": {
280-
const values = parseStringArrayValue(value);
280+
const values = parseStringArrayValue(value ?? "");
281281

282282
return (
283283
<TagInput
@@ -525,8 +525,8 @@ const isValidParameterOption = (
525525
previewParam: PreviewParameter,
526526
buildParam: WorkspaceBuildParameter,
527527
) => {
528+
// multi-select is the only list(string) type with options
528529
if (previewParam.form_type === "multi-select") {
529-
console.log("buildParam.value", buildParam.value);
530530
let values: string[] = [];
531531
try {
532532
const parsed = JSON.parse(buildParam.value);
@@ -541,24 +541,24 @@ const isValidParameterOption = (
541541
return false;
542542
}
543543

544-
// If options exist, validate each value
545544
if (previewParam.options.length > 0) {
546545
const validValues = previewParam.options.map(
547546
(option) => option.value.value,
548547
);
549-
return values.every((value) => validValues.includes(value));
548+
return values.some((value) => validValues.includes(value));
550549
}
551550
return false;
552551
}
553-
// For parameters with options (dropdown, radio, etc.)
552+
553+
// For parameters with options (dropdown, radio)
554554
if (previewParam.options.length > 0) {
555555
const validValues = previewParam.options.map(
556556
(option) => option.value.value,
557557
);
558558
return validValues.includes(buildParam.value);
559559
}
560560

561-
// For parameters without options (input, textarea, etc.)
561+
// For parameters without options (input,textarea,switch,checkbox,tag-select)
562562
return true;
563563
};
564564

0 commit comments

Comments
 (0)