Skip to content

Commit 137851b

Browse files
Fix 4733 by fixing the ArrayField.onSelectChange function (rjsf-team#4737)
* Fix 4733 by fixing the ArrayField.onSelectChange function Fixes rjsf-team#4733 by fixing how the `ArrayField.onSelectChange()` callback passes the path - Updated `ArrayField` `onSelectChange` to not pass `name` in the `path` since the `ObjectField` will automatically add it - Updated the `CHANGELOG.md` accordingly * - Fixed a comment * - Updated `CHANGELOG.md`
1 parent 3573065 commit 137851b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ should change the heading of the (upcoming) version to include a major version b
1717
-->
1818
# 6.0.0-beta.15
1919

20+
## @rjsf/core
21+
22+
- Updated `ArrayField` `onSelectChange` to not pass `name` in the `path` since the `ObjectField` will automatically add it [#4733](https://github.com/rjsf-team/react-jsonschema-form/issues/4733)
23+
2024
## @rjsf/semantic-ui
2125

2226
- Updated `ArrayField` to stop using `nanoid` and instead use `lodash/uniqueId` to fix [#4762](https://github.com/rjsf-team/react-jsonschema-form/issues/4726)

packages/core/src/components/fields/ArrayField.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,9 @@ class ArrayField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends For
418418

419419
/** Callback handler used to change the value for a checkbox */
420420
onSelectChange = (value: any) => {
421-
const { name, onChange, idSchema } = this.props;
422-
// select change will pass the `path` array with the name
423-
onChange(value, [name], undefined, idSchema && idSchema.$id);
421+
const { onChange, idSchema } = this.props;
422+
// select change will pass an empty `path` array since the `ObjectField` will add the path value automatically
423+
onChange(value, [], undefined, idSchema && idSchema.$id);
424424
};
425425

426426
/** Helper method to compute item UI schema for both normal and fixed arrays

0 commit comments

Comments
 (0)