Skip to content

Commit

Permalink
1342: add .length check
Browse files Browse the repository at this point in the history
  • Loading branch information
sinejespersen committed May 16, 2024
1 parent 3cf36aa commit 0665bb5
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ function MultiSelectComponent({

/** Map data to fit component. */
useEffect(() => {
const localMappedOptions = options ? mapDataToFitMultiselect(options) : [];
const localMappedOptions =
options.length > 0 ? mapDataToFitMultiselect(options) : [];

const localMappedSelected = options
? mapDataToFitMultiselect(selected)
: [];
const localMappedSelected =
selected.length > 0 ? mapDataToFitMultiselect(selected) : [];

const optionsWithSelected = removeDuplicatesByKey(
[...localMappedOptions, ...localMappedSelected],
Expand Down

0 comments on commit 0665bb5

Please sign in to comment.