Skip to content

Commit

Permalink
Merge pull request #334 from rclankhorst/master
Browse files Browse the repository at this point in the history
fix: MultiSelectElement does not allow for options w/ { id: '0' }
  • Loading branch information
dohomi authored Dec 5, 2024
2 parents a423841 + 74f0c5b commit c9fca0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions apps/storybook/stories/MultiSelectElement.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ export const WithCheckbox: Story = {
}

const objectVals = [
{id: 1, name: 'Alpha'},
{id: 2, name: 'Beta'},
{id: 3, name: 'Celsius'},
{id: 4, name: 'Delta'},
{id: 0, name: 'Alpha'},
{id: 1, name: 'Beta'},
{id: 2, name: 'Celsius'},
{id: 3, name: 'Delta'},
]

export const WithObjectArray: Story = {
Expand Down
2 changes: 1 addition & 1 deletion packages/rhf-mui/src/MultiSelectElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ const MultiSelectElement = forwardRef(function MultiSelectElement<
inputRef={handleInputRef}
>
{options.map((item) => {
const val: string | number = item[itemValue || itemKey] || item
const val: string | number = item[itemValue || itemKey] ?? item
const isChecked = Array.isArray(value)
? value.some((v) => v === val)
: false
Expand Down

0 comments on commit c9fca0e

Please sign in to comment.