Skip to content

Commit

Permalink
fix isMultiple check by adding compare with false (#3811)
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Grosenbacher <nickgrosenbacher@gmail.com>
  • Loading branch information
antpaw and nickgros authored Sep 1, 2023
1 parent 89df5cd commit b07eda3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ should change the heading of the (upcoming) version to include a major version b

- Updated `MultiSchemaField` to only merge top level required field fixing duplicate field and description.

## @rjsf/chakra-ui

- Fixed a faulty check of the `isMultiple` option in `MultiSchemaField`. It no longer offers multiple choice inside a select field in a `oneOf` case in Chakra UI, fixing [#3848](https://github.com/rjsf-team/react-jsonschema-form/issues/3848)

# 5.12.1

## @rjsf/validator-ajv8
Expand Down
2 changes: 1 addition & 1 deletion packages/chakra-ui/src/SelectWidget/SelectWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default function SelectWidget<T = any, S extends StrictRJSFSchema = RJSFS
})
: [];

const isMultiple = typeof multiple !== 'undefined' && Boolean(enumOptions);
const isMultiple = typeof multiple !== 'undefined' && multiple !== false && Boolean(enumOptions);
const selectedIndex = enumOptionsIndexForValue<S>(value, enumOptions, isMultiple);
const formValue: any = isMultiple
? ((selectedIndex as string[]) || []).map((i: string) => {
Expand Down

0 comments on commit b07eda3

Please sign in to comment.