Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix isMultiple check by adding compare with false #3811

Merged
merged 3 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
antpaw marked this conversation as resolved.
Show resolved Hide resolved
const selectedIndex = enumOptionsIndexForValue<S>(value, enumOptions, isMultiple);
const formValue: any = isMultiple
? ((selectedIndex as string[]) || []).map((i: string) => {
Expand Down