Skip to content

Commit

Permalink
Fix 4382 by passing errorSchema and id through in NumberField's onCha…
Browse files Browse the repository at this point in the history
…nge (#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
  • Loading branch information
heath-freenome authored Nov 22, 2024
1 parent b870298 commit 5a8fbdb
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 21 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ should change the heading of the (upcoming) version to include a major version b
-->

# 5.23.1

## @rjsf/chakra-ui

- 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)

## @rjsf/core

- 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)

## Dev / docs / playground

- Updated the peer dependencies for `@rjsf/*` to be `5.23.x`

# 5.23.0

## @rjsf/core
Expand Down
4 changes: 2 additions & 2 deletions packages/antd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
},
"peerDependencies": {
"@ant-design/icons": "^4.0.0 || ^5.0.0",
"@rjsf/core": "^5.22.x",
"@rjsf/utils": "^5.22.x",
"@rjsf/core": "^5.23.x",
"@rjsf/utils": "^5.23.x",
"antd": "^4.24.0 || ^5.8.5",
"dayjs": "^1.8.0",
"react": "^16.14.0 || >=17"
Expand Down
4 changes: 2 additions & 2 deletions packages/bootstrap-4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
]
},
"peerDependencies": {
"@rjsf/core": "^5.22.x",
"@rjsf/utils": "^5.22.x",
"@rjsf/core": "^5.23.x",
"@rjsf/utils": "^5.23.x",
"react": "^16.14.0 || >=17",
"react-bootstrap": "^1.6.5"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/chakra-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"@chakra-ui/icons": ">=1.1.1",
"@chakra-ui/react": ">=1.7.3 <3.0.0",
"@chakra-ui/system": ">=1.12.1",
"@rjsf/core": "^5.22.x",
"@rjsf/utils": "^5.22.x",
"@rjsf/core": "^5.23.x",
"@rjsf/utils": "^5.23.x",
"chakra-react-select": ">=3.3.8",
"framer-motion": ">=5.6.0",
"react": "^16.14.0 || >=17"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"node": ">=14"
},
"peerDependencies": {
"@rjsf/utils": "^5.22.x",
"@rjsf/utils": "^5.23.x",
"react": "^16.14.0 || >=17"
},
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/components/fields/NumberField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState, useCallback } from 'react';
import { asNumber, FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
import { asNumber, ErrorSchema, FieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';

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

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

onChange(processed as unknown as T);
onChange(processed as unknown as T, errorSchema, id);
},
[onChange]
);
Expand Down
4 changes: 2 additions & 2 deletions packages/fluent-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
},
"peerDependencies": {
"@fluentui/react": ">= 7",
"@rjsf/core": "^5.22.x",
"@rjsf/utils": "^5.22.x",
"@rjsf/core": "^5.23.x",
"@rjsf/utils": "^5.23.x",
"react": "^16.14.0 || >=17"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/fluentui-rc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"node": ">=14"
},
"peerDependencies": {
"@rjsf/utils": "^5.22.x",
"@rjsf/utils": "^5.23.x",
"react": "^16.14.0 || >=17"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"peerDependencies": {
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"@rjsf/core": "^5.22.x",
"@rjsf/utils": "^5.22.x",
"@rjsf/core": "^5.23.x",
"@rjsf/utils": "^5.23.x",
"react": "^16.14.0 || >=17"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/mui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"@emotion/styled": "^11.6.0",
"@mui/icons-material": "^5.2.0 || ^6.0.0",
"@mui/material": "^5.2.2 || ^6.0.0",
"@rjsf/core": "^5.22.x",
"@rjsf/utils": "^5.22.x",
"@rjsf/core": "^5.23.x",
"@rjsf/utils": "^5.23.x",
"react": ">=17"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/semantic-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
]
},
"peerDependencies": {
"@rjsf/core": "^5.22.x",
"@rjsf/utils": "^5.22.x",
"@rjsf/core": "^5.23.x",
"@rjsf/utils": "^5.23.x",
"react": "^16.14.0 || >=17",
"semantic-ui-react": "^1.3.1 || ^2.1.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/validator-ajv6/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"lodash-es": "^4.17.21"
},
"peerDependencies": {
"@rjsf/utils": "^5.22.x"
"@rjsf/utils": "^5.23.x"
},
"devDependencies": {
"@babel/core": "^7.23.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/validator-ajv8/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"lodash-es": "^4.17.21"
},
"peerDependencies": {
"@rjsf/utils": "^5.22.x"
"@rjsf/utils": "^5.23.x"
},
"devDependencies": {
"@babel/core": "^7.23.9",
Expand Down

0 comments on commit 5a8fbdb

Please sign in to comment.