Workday/canvas-kit

Select component does not accept undefined for initialSelectedIds

Closed this issue ยท 0 comments

๐Ÿ› Bug Report

useSelectInput throws error if initialSelectedIds is set to undefined.

(property) initialSelectedIds?: SelectedIds | undefined

Link to repl or repo (highly encouraged)

https://github.com/Workday/canvas-kit/blob/60ab75c33942c15bb1fd116ca19bdebeb005a99d/modules/react/select/lib/hooks/useSelectInput.ts

##Error Output
TypeError: Cannot read properties of undefined (reading 'length')

    <Select initialSelectedIds={id ? [id]: undefined} items={items} getTextValue={getTextValue}>
      <Select.Input {...props} />
      <Select.Popper>
        <Select.Card>
          <Select.List>
             ....
          </Select.List>
        </Select.Card>
      </Select.Popper>
    </Select>