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(material-ui): fix RangeWidget onChange handler #2161 #3297

Merged

Conversation

JonCatmull
Copy link
Contributor

@JonCatmull JonCatmull commented Dec 16, 2022

fix: #2161

RangeWidget's onChange handler for material-ui package was broken due to conditional being the wrong way around. This caused new non empty values to be changed to options.emptyValue on change.

Copy link
Contributor Author

@JonCatmull JonCatmull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RangeWidget's onChange handler for material-ui package was broken due to conditional being the wrong way around. This caused new non empty values to be changed to options.emptyValue on change.

@@ -19,7 +19,7 @@ const RangeWidget = ({
const sliderProps = { value, label, id, name: id, ...rangeSpec(schema) };

const _onChange = (_: any, value?: number | number[]) => {
onChange(value ? options.emptyValue : value);
onChange(value ? value : options.emptyValue);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It it likely that the same code is in packages/mui/src/RangeWidget/RangeWidget.tsx. Please update that as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, done.

@heath-freenome
Copy link
Collaborator

@JonCatmull Oh shoot, I forgot to ask you to upgrade the CHANGELOG.md file to describe these fixes for both @rjsf/material-ui and @rjsf/mui

@heath-freenome
Copy link
Collaborator

@JonCatmull Oh shoot, I forgot to ask you to upgrade the CHANGELOG.md file to describe these fixes for both @rjsf/material-ui and @rjsf/mui

NVM, I'm making a fix and will add them myself so that we can get this merged quicker

@heath-freenome heath-freenome merged commit 68db429 into rjsf-team:main Dec 21, 2022
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this pull request Dec 21, 2022
…/utils

fix: rjsf-team#3239 by providing a new `ErrorSchemaBuilder` class in `@rjsf/utils`
- In `@rjsf/utils` added `ErrorSchemaBuilder` to facilitate building `ErrorSchema` objects without the need for fancy casting
  - Exported the new class as part of the main `index.js`
  - Added 100% unit tests
- In `@rjsf/validator-ajv6` and `@rjsf/validator-ajv8` updated the `toErrorSchema()` function to use the `ErrorSchemaBuilder` to simplify the implementation
  - Also updated the tests to use the `ErrorSchemaBuilder` to replace the expected values that required doing `as ErrorSchema` casting
- Updated the `utility-functions.md` file to document `ErrorSchemaBuilder`
- Updated the `CHANGELOG.md` accordingly for this fix as well as PR rjsf-team#3297
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this pull request Dec 22, 2022
…/utils

fix: rjsf-team#3239 by providing a new `ErrorSchemaBuilder` class in `@rjsf/utils`
- In `@rjsf/utils` added `ErrorSchemaBuilder` to facilitate building `ErrorSchema` objects without the need for fancy casting
  - Exported the new class as part of the main `index.js`
  - Added 100% unit tests
- In `@rjsf/validator-ajv6` and `@rjsf/validator-ajv8` updated the `toErrorSchema()` function to use the `ErrorSchemaBuilder` to simplify the implementation
  - Also updated the tests to use the `ErrorSchemaBuilder` to replace the expected values that required doing `as ErrorSchema` casting
- Updated the `utility-functions.md` file to document `ErrorSchemaBuilder`
- Updated the `CHANGELOG.md` accordingly for this fix as well as PR rjsf-team#3297
heath-freenome added a commit that referenced this pull request Dec 22, 2022
…3307)

fix: #3239 by providing a new `ErrorSchemaBuilder` class in `@rjsf/utils`
- In `@rjsf/utils` added `ErrorSchemaBuilder` to facilitate building `ErrorSchema` objects without the need for fancy casting
  - Exported the new class as part of the main `index.js`
  - Added 100% unit tests
- In `@rjsf/validator-ajv6` and `@rjsf/validator-ajv8` updated the `toErrorSchema()` function to use the `ErrorSchemaBuilder` to simplify the implementation
  - Also updated the tests to use the `ErrorSchemaBuilder` to replace the expected values that required doing `as ErrorSchema` casting
- Updated the `utility-functions.md` file to document `ErrorSchemaBuilder`
- Updated the `CHANGELOG.md` accordingly for this fix as well as PR #3297
shijistar pushed a commit to shijistar/react-jsonschema-form that referenced this pull request Jun 8, 2023
…sf-team#3297)

* fix(material-ui): fix RangeWidget onChange handler rjsf-team#2161

* fix(mui): fix RangeWidget onChange handler rjsf-team#2161

Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com>
shijistar pushed a commit to shijistar/react-jsonschema-form that referenced this pull request Jun 8, 2023
…/utils (rjsf-team#3307)

fix: rjsf-team#3239 by providing a new `ErrorSchemaBuilder` class in `@rjsf/utils`
- In `@rjsf/utils` added `ErrorSchemaBuilder` to facilitate building `ErrorSchema` objects without the need for fancy casting
  - Exported the new class as part of the main `index.js`
  - Added 100% unit tests
- In `@rjsf/validator-ajv6` and `@rjsf/validator-ajv8` updated the `toErrorSchema()` function to use the `ErrorSchemaBuilder` to simplify the implementation
  - Also updated the tests to use the `ErrorSchemaBuilder` to replace the expected values that required doing `as ErrorSchema` casting
- Updated the `utility-functions.md` file to document `ErrorSchemaBuilder`
- Updated the `CHANGELOG.md` accordingly for this fix as well as PR rjsf-team#3297
shijistar pushed a commit to shijistar/react-jsonschema-form that referenced this pull request Jun 8, 2023
…sf-team#3297)

* fix(material-ui): fix RangeWidget onChange handler rjsf-team#2161

* fix(mui): fix RangeWidget onChange handler rjsf-team#2161

Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com>
shijistar pushed a commit to shijistar/react-jsonschema-form that referenced this pull request Jun 8, 2023
…/utils (rjsf-team#3307)

fix: rjsf-team#3239 by providing a new `ErrorSchemaBuilder` class in `@rjsf/utils`
- In `@rjsf/utils` added `ErrorSchemaBuilder` to facilitate building `ErrorSchema` objects without the need for fancy casting
  - Exported the new class as part of the main `index.js`
  - Added 100% unit tests
- In `@rjsf/validator-ajv6` and `@rjsf/validator-ajv8` updated the `toErrorSchema()` function to use the `ErrorSchemaBuilder` to simplify the implementation
  - Also updated the tests to use the `ErrorSchemaBuilder` to replace the expected values that required doing `as ErrorSchema` casting
- Updated the `utility-functions.md` file to document `ErrorSchemaBuilder`
- Updated the `CHANGELOG.md` accordingly for this fix as well as PR rjsf-team#3297
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Number slider is broken for the number.
2 participants