Skip to content

Commit

Permalink
added generic as default option
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaElastic committed Dec 5, 2022
1 parent 5d4f6f1 commit 983f473
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ export const DatasetComboBox: React.FC<{
datasets: string[];
}> = ({ value, onChange, datasets }) => {
const datasetOptions = datasets.map((dataset: string) => ({ label: dataset })) ?? [];
const [selectedOptions, setSelectedOptions] = useState<Array<{ label: string }>>(
value
? [
{
label: value,
},
]
: []
);
const defaultOption = 'generic';
const [selectedOptions, setSelectedOptions] = useState<Array<{ label: string }>>([
{
label: value ?? defaultOption,
},
]);

if (!value) onChange(defaultOption);

const onDatasetChange = (newSelectedOptions: Array<{ label: string }>) => {
setSelectedOptions(newSelectedOptions);
Expand Down

0 comments on commit 983f473

Please sign in to comment.