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

Problem with contains condition in the array field and conditionally rendered subschema with the integer keys when liveOmmit and omitExtraData are set to true #3920

Open
4 tasks done
magaton opened this issue Oct 25, 2023 · 1 comment
Labels
any-one-all-of Related to fixing anyOf, oneOf or allOf arrays bug help wanted if-then-else Issues related to handling JSON Schema if/then/else

Comments

@magaton
Copy link

magaton commented Oct 25, 2023

Prerequisites

What theme are you using?

mui

Version

5.13.2

Current Behavior

I have hit a strange bug, not sure where to look, so I will post working and not working schemas. Hopefully, the maintainers will have an idea of what is wrong.

#1. if-then with contains. The conditionally rendered schema has string keys. This works.
#2. if-then with contains. The conditionally rendered schema has integer keys. This does not work.

Both work well when liveOmmit and omitExtraData are set to false

Expected Behavior

I would expect that both scenarios work with turned on liveOmmit and omitExtraData.
However it seems that they reset the field that is used for rendering the dependent schema, but only if that field options match the keys in the dependent schema.
This looks like a bug to me

Steps To Reproduce

#1

#2

Environment

- OS: MacOsx
- Node: latest
- npm: latest

Anything else?

No response

@magaton magaton added bug needs triage Initial label given, to be assigned correct labels and assigned labels Oct 25, 2023
@heath-freenome
Copy link
Member

@magaton The issue might be in one of three places:
In @rjsf/utils: either the pathToSchema() is generating a bad or missing schema path in which case MAYBE #3916 will fix it? Possibly the retrieveSchema() might not be parsing properly for the second condition? Or maybe the getDefaultFormState() function is behaving differently for these two situations

OR perhaps our code for omitting live data in the Form is buggy?

Anyways, if you are able to debug this and figure out where the bug is, we'd love fix! Thanks

@heath-freenome heath-freenome added help wanted arrays any-one-all-of Related to fixing anyOf, oneOf or allOf if-then-else Issues related to handling JSON Schema if/then/else and removed needs triage Initial label given, to be assigned correct labels and assigned labels Oct 27, 2023
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 arrays bug help wanted if-then-else Issues related to handling JSON Schema if/then/else
Projects
None yet
Development

No branches or pull requests

2 participants