Skip to content

Commit 5a8fbdb

Browse files
Fix 4382 by passing errorSchema and id through in NumberField's onChange (#4395)
Fixes #4382 - Updated `NumberField`'s `handleChange` callback to pass through the `errorSchema` and `id` - Updated the peerDependencies for the packages to be `5.23.x` - Updated `CHANGELOG.md` accordingly
1 parent b870298 commit 5a8fbdb

File tree

13 files changed

+35
-21
lines changed

13 files changed

+35
-21
lines changed

CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@ should change the heading of the (upcoming) version to include a major version b
1616
1717
-->
1818

19+
# 5.23.1
20+
21+
## @rjsf/chakra-ui
22+
23+
- Updated `package.json` to restrict `@chakra-ui/react`'s peer dependency to be < 3.0.0, fixing [#4390](https://github.com/rjsf-team/react-jsonschema-form/issues/4390)
24+
25+
## @rjsf/core
26+
27+
- Updated `NumberField` to properly pass through the `errorSchema` and `id` in the onChange handler, fixing [#4382](https://github.com/rjsf-team/react-jsonschema-form/issues/4382)
28+
29+
## Dev / docs / playground
30+
31+
- Updated the peer dependencies for `@rjsf/*` to be `5.23.x`
32+
1933
# 5.23.0
2034

2135
## @rjsf/core

packages/antd/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
},
3535
"peerDependencies": {
3636
"@ant-design/icons": "^4.0.0 || ^5.0.0",
37-
"@rjsf/core": "^5.22.x",
38-
"@rjsf/utils": "^5.22.x",
37+
"@rjsf/core": "^5.23.x",
38+
"@rjsf/utils": "^5.23.x",
3939
"antd": "^4.24.0 || ^5.8.5",
4040
"dayjs": "^1.8.0",
4141
"react": "^16.14.0 || >=17"

packages/bootstrap-4/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
]
3434
},
3535
"peerDependencies": {
36-
"@rjsf/core": "^5.22.x",
37-
"@rjsf/utils": "^5.22.x",
36+
"@rjsf/core": "^5.23.x",
37+
"@rjsf/utils": "^5.23.x",
3838
"react": "^16.14.0 || >=17",
3939
"react-bootstrap": "^1.6.5"
4040
},

packages/chakra-ui/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
"@chakra-ui/icons": ">=1.1.1",
3838
"@chakra-ui/react": ">=1.7.3 <3.0.0",
3939
"@chakra-ui/system": ">=1.12.1",
40-
"@rjsf/core": "^5.22.x",
41-
"@rjsf/utils": "^5.22.x",
40+
"@rjsf/core": "^5.23.x",
41+
"@rjsf/utils": "^5.23.x",
4242
"chakra-react-select": ">=3.3.8",
4343
"framer-motion": ">=5.6.0",
4444
"react": "^16.14.0 || >=17"

packages/core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"node": ">=14"
3838
},
3939
"peerDependencies": {
40-
"@rjsf/utils": "^5.22.x",
40+
"@rjsf/utils": "^5.23.x",
4141
"react": "^16.14.0 || >=17"
4242
},
4343
"dependencies": {

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState, useCallback } from 'react';
2-
import { asNumber, FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2+
import { asNumber, ErrorSchema, FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
33

44
// Matches a string that ends in a . character, optionally followed by a sequence of
55
// digits followed by any number of 0 characters up until the end of the line.
@@ -44,7 +44,7 @@ function NumberField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
4444
* @param value - The current value for the change occurring
4545
*/
4646
const handleChange = useCallback(
47-
(value: FieldProps<T, S, F>['value']) => {
47+
(value: FieldProps<T, S, F>['value'], errorSchema?: ErrorSchema<T>, id?: string) => {
4848
// Cache the original value in component state
4949
setLastValue(value);
5050

@@ -62,7 +62,7 @@ function NumberField<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends
6262
? asNumber(value.replace(trailingCharMatcher, ''))
6363
: asNumber(value);
6464

65-
onChange(processed as unknown as T);
65+
onChange(processed as unknown as T, errorSchema, id);
6666
},
6767
[onChange]
6868
);

packages/fluent-ui/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
},
3535
"peerDependencies": {
3636
"@fluentui/react": ">= 7",
37-
"@rjsf/core": "^5.22.x",
38-
"@rjsf/utils": "^5.22.x",
37+
"@rjsf/core": "^5.23.x",
38+
"@rjsf/utils": "^5.23.x",
3939
"react": "^16.14.0 || >=17"
4040
},
4141
"devDependencies": {

packages/fluentui-rc/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"node": ">=14"
3838
},
3939
"peerDependencies": {
40-
"@rjsf/utils": "^5.22.x",
40+
"@rjsf/utils": "^5.23.x",
4141
"react": "^16.14.0 || >=17"
4242
},
4343
"dependencies": {

packages/material-ui/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
"peerDependencies": {
3535
"@material-ui/core": "^4.12.3",
3636
"@material-ui/icons": "^4.11.2",
37-
"@rjsf/core": "^5.22.x",
38-
"@rjsf/utils": "^5.22.x",
37+
"@rjsf/core": "^5.23.x",
38+
"@rjsf/utils": "^5.23.x",
3939
"react": "^16.14.0 || >=17"
4040
},
4141
"devDependencies": {

packages/mui/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
"@emotion/styled": "^11.6.0",
3737
"@mui/icons-material": "^5.2.0 || ^6.0.0",
3838
"@mui/material": "^5.2.2 || ^6.0.0",
39-
"@rjsf/core": "^5.22.x",
40-
"@rjsf/utils": "^5.22.x",
39+
"@rjsf/core": "^5.23.x",
40+
"@rjsf/utils": "^5.23.x",
4141
"react": ">=17"
4242
},
4343
"devDependencies": {

packages/semantic-ui/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
]
3434
},
3535
"peerDependencies": {
36-
"@rjsf/core": "^5.22.x",
37-
"@rjsf/utils": "^5.22.x",
36+
"@rjsf/core": "^5.23.x",
37+
"@rjsf/utils": "^5.23.x",
3838
"react": "^16.14.0 || >=17",
3939
"semantic-ui-react": "^1.3.1 || ^2.1.3"
4040
},

packages/validator-ajv6/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"lodash-es": "^4.17.21"
3838
},
3939
"peerDependencies": {
40-
"@rjsf/utils": "^5.22.x"
40+
"@rjsf/utils": "^5.23.x"
4141
},
4242
"devDependencies": {
4343
"@babel/core": "^7.23.9",

packages/validator-ajv8/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"lodash-es": "^4.17.21"
4040
},
4141
"peerDependencies": {
42-
"@rjsf/utils": "^5.22.x"
42+
"@rjsf/utils": "^5.23.x"
4343
},
4444
"devDependencies": {
4545
"@babel/core": "^7.23.9",

0 commit comments

Comments
 (0)