rjsf-team / react-jsonschema-form

A React component for building Web forms from JSON Schema.
https://rjsf-team.github.io/react-jsonschema-form/
Apache License 2.0
14.36k stars 2.19k forks source link

Playground: Any Of with Custom Field example and UI schema doesn't seem to work as it should #3235

Open rap1ds opened 2 years ago

rap1ds commented 2 years ago

Prerequisites

What theme are you using?

other

Version

5.x

Current Behavior

In Playground, when you pick Any Of with Custom Field example, you see:

See screenshot

Expected Behavior

Steps To Reproduce

  1. Go to Playground (https://rjsf-team.github.io/react-jsonschema-form/)
  2. Pick Any Of with Custom Field example

Expected: UISchema with custom field, rendered output is the custom field, not dropdown with two options

Actual: UISchema is empty, rendered output is dropdown with two options

If I pick another example, I can see the custom field correctly rendered, but UI Schema is still empty. Steps:

  1. Go to Playground (https://rjsf-team.github.io/react-jsonschema-form/)
  2. Pick Any Of with Custom Field example
  3. Now pick One of example
  4. And then again pick Any Of with Custom Field example

Expected: UISchema with custom field, rendered output is the custom field, not dropdown of two options

Actual: UISchema is empty, rendered output is the custom field, not dropdown of two options

Environment

Playground with Google Chrome

Anything else?

Screen Shot 2022-11-09 at 9 43 57
heath-freenome commented 1 year ago

@rap1ds WOW! That is a really interesting issue. It turns out that the Any Of with Custom Field example has a react component embedded in the uiSchema but the editor code doesn't know how to deal with it, therefore showing an empty uiSchema, which is saved into state. When you switch back the component is lost. We'll have to figure out how to fix it, eventually. Thanks!

Nezteb commented 1 year ago

I've also noticed that the "Any Of with Custom Field" example is weirdly broken:

CleanShot 2023-08-07 at 22 42 56@2x

The display on the right is incorrect. If you copy the schema, click on the "Simple" example, and paste the JSON, it will work properly:

CleanShot 2023-08-07 at 22 50 49@2x
heath-freenome commented 1 year ago

@Nezteb thanks for pointing that out! The custom field is what renders the latitude and longitude.

stale[bot] commented 1 week ago

This issue has been automatically marked as possibly close because it has not had recent activity. It will be closed if no further activity occurs. Please leave a comment if this is still an issue for you. Thank you.