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 multiple bugs related to switching between anyOf/oneOf options #1169

Merged
merged 3 commits into from
Feb 21, 2019

Conversation

LucianBuzzo
Copy link
Collaborator

@LucianBuzzo LucianBuzzo commented Feb 6, 2019

Fixes #1168

  • Fixed a bug that would prevent input fields from rendering when
    switching between a non-object type option and an object type option
  • Fixed a bug where options would incorrectly change when entering
    values if a subschema with multiple required fields is used
  • Fixed a bug where switching from an object type option to a non-object
    type option would result in an input field containing the value [Object object]

Change-type: patch
Signed-off-by: Lucian lucian.buzzo@gmail.com

Checklist

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests
    • I've updated docs if needed
    • I've run npm run cs-format on my branch to conform my code to prettier coding style
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

Copy link
Member

@epicfaace epicfaace left a comment

Choose a reason for hiding this comment

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

Looks good, I just have a few questions about understanding the logic. Would appreciate if you could explain those a bit more!

src/components/fields/MultiSchemaField.js Outdated Show resolved Hide resolved
test/anyOf_test.js Outdated Show resolved Hide resolved
test/anyOf_test.js Outdated Show resolved Hide resolved
@@ -237,7 +237,7 @@ class ObjectField extends Component {
errorSchema={errorSchema[name]}
idSchema={idSchema[name]}
idPrefix={idPrefix}
formData={formData[name]}
formData={(formData || {})[name]}
Copy link
Member

Choose a reason for hiding this comment

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

In what case(s) would formData be null?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

formData can be null if you have just added an item to an array

src/utils.js Outdated Show resolved Hide resolved
src/components/fields/MultiSchemaField.js Show resolved Hide resolved
Fixes #1168

- Fixed a bug that would prevent input fields from rendering when
switching between a non-object type option and an object type option
- Fixed a bug where options would incorrectly change when entering
values if a subschema with multiple required fields is used
- Fixed a bug where switching from an object tpye option to a non-object
type option would result in an input field containing the value [Object object]

Change-type: patch
Signed-off-by: Lucian <lucian.buzzo@gmail.com>
@LucianBuzzo
Copy link
Collaborator Author

@epicfaace Can you please re-review this PR when you have a chance?

@loctn
Copy link

loctn commented Feb 20, 2019

Do not mean to rush you @epicfaace , but excited for this fix to land ^_^.

src/utils.js Outdated Show resolved Hide resolved
src/utils.js Outdated Show resolved Hide resolved
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.

3 participants