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

Default values not set inside allOf #3892

Closed
4 tasks done
magaton opened this issue Oct 4, 2023 · 8 comments · Fixed by #3969
Closed
4 tasks done

Default values not set inside allOf #3892

magaton opened this issue Oct 4, 2023 · 8 comments · Fixed by #3969
Labels
any-one-all-of Related to fixing anyOf, oneOf or allOf bug defaults help wanted if-then-else Issues related to handling JSON Schema if/then/else

Comments

@magaton
Copy link

magaton commented Oct 4, 2023

Prerequisites

What theme are you using?

mui

Version

5.x

Current Behavior

Default values are not set inside allOf

Expected Behavior

The default values should be set

Steps To Reproduce

playground link

Environment

- OS:
- Node:
- npm:

Anything else?

This is kind of similar to the previously reported issue and pull request that should have fixed the same problem inside oneOf and anyOf.

@magaton magaton added bug needs triage Initial label given, to be assigned correct labels and assigned labels Oct 4, 2023
@heath-freenome heath-freenome added defaults any-one-all-of Related to fixing anyOf, oneOf or allOf if-then-else Issues related to handling JSON Schema if/then/else help wanted and removed needs triage Initial label given, to be assigned correct labels and assigned labels Oct 6, 2023
@heath-freenome
Copy link
Member

@magaton Looks like you found another limitation in our allOf and/or if-then-else support. Is this something you are willing to try and fix?

@magaton
Copy link
Author

magaton commented Oct 6, 2023

I'd rather keep my qa / user tester hat since I am not a React or front-end developer. Maybe you could state what exactly needs to be done, so somebody can pick it up easier?

@heath-freenome
Copy link
Member

Basically our getDefaultFormState() code does not process if-then-else or allOf statements at the moment. Thus additional work needs to happen to support these capabilities

@suman313
Copy link

suman313 commented Oct 8, 2023

Hi @heath-freenome ,
I would like to work on this issue.
Please assign me this issue.

@monkey-pHy
Copy link

Hi @heath-freenome , I would like to work on this issue. Please assign me this issue.

Thanks for your help, I use allOf and have the same issue. I would like to subscibe this issue.

@MarekBodingerBA
Copy link
Contributor

This is a duplicate of my issue: #3832

As there is no response in my thread, I am hijacking this one. I've managed to debug the reason why this happens.

As an temporary fix we created our own fork with the fix and we patch the package to have this functionality as we rely heavily on allOf in our schemas.

The fix has performance implications, from our internal testing getDefaultFormState takes multiples of the original time. It's OK for us, but we had to implement a custom optimization for input fields that commits the value on blur instead of on change.

@heath-freenome
Copy link
Member

heath-freenome commented Oct 16, 2023

@MarekBodingerBA Sorry we missed responding to your original issue. Given the solution causes a performance degradation, we definitely would not want to add it as the default behavior. We would definitely be open to adding it as an opt-in feature via a new experimental_defaultFormStateBehavior.allOf flag. Check out the documentation of this capability and let us know whether this is something you'd like to build into the main product for us? I'm guessing that it would be a simple add to your already existing fix. Then you could create a new PR for use to review on the main repo.

@benjdlambert
Copy link
Contributor

@heath-freenome I went ahead and threw all this in a PR. Had some questions about the configuration schema, but seems to fix this issue and my previous issue which turned out to be a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
any-one-all-of Related to fixing anyOf, oneOf or allOf bug defaults help wanted if-then-else Issues related to handling JSON Schema if/then/else
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants