diff --git a/components/transfer/src/transfer.js b/components/transfer/src/transfer.js index a36a9c5f43..deca9a9f9f 100644 --- a/components/transfer/src/transfer.js +++ b/components/transfer/src/transfer.js @@ -138,14 +138,21 @@ export const Transfer = ({ * Extract the selected options. Can't use `options.filter` * because we need to keep the order of `selected` */ - const pickedOptions = actualFilterPickedCallback( - selected - .map((value) => options.find((option) => value === option.value)) - // filter -> in case a selected value has been provided - // that does not exist as option - .filter(identity), - actualFilterPicked - ) + let pickedOptions = [] + + // Only map if selected is an array + if (Array.isArray(selected)) { + pickedOptions = actualFilterPickedCallback( + selected + .map((value) => + options.find((option) => value === option.value) + ) + // filter -> in case a selected value has been provided + // that does not exist as option + .filter(identity), + actualFilterPicked + ) + } /* * Source options highlighting: