Skip to content

$ref object pointing to oneOf list does not update form properly when changed #3833

Open
@Nezteb

Description

@Nezteb

Prerequisites

What theme are you using?

core

Version

5.x

Current Behavior

$ref objects pointing to objects with oneOf lists do not update properly when a user tries to change the value via dropdown.

Expected Behavior

The dropdowns should be updating properly when the user changes the value.

Steps To Reproduce

  1. Use the playground/schema below.
  2. Try to change the "Approved" dropdown to "Rejected".
  3. Note that the dropdown doesn't actually change.

Playground link: https://rjsf-team.github.io/react-jsonschema-form/#eyJmb3JtRGF0YSI6e30sInNjaGVtYSI6eyJ0aXRsZSI6Im9uZU9mIEV4YW1wbGUiLCJ0eXBlIjoib2JqZWN0IiwicHJvcGVydGllcyI6eyJzdGF0dXMiOnsiJHJlZiI6IiMvZGVmaW5pdGlvbnMvc3RhdHVzIn19LCJkZWZpbml0aW9ucyI6eyJzdGF0dXMiOnsidGl0bGUiOiJGaWVsZCBTdGF0dXMiLCJ0eXBlIjoib2JqZWN0Iiwib25lT2YiOlt7InRpdGxlIjoiQXBwcm92ZWQiLCJ0eXBlIjoib2JqZWN0In0seyJ0aXRsZSI6IlJlamVjdGVkIiwidHlwZSI6Im9iamVjdCIsInByb3BlcnRpZXMiOnsicmVhc29uIjp7InRpdGxlIjoiUmVqZWN0aW9uIFJlYXNvbiIsInR5cGUiOiJzdHJpbmcifX19XX19fSwidWlTY2hlbWEiOnt9LCJ0aGVtZSI6ImRlZmF1bHQiLCJsaXZlU2V0dGluZ3MiOnsic2hvd0Vycm9yTGlzdCI6InRvcCIsImV4cGVyaW1lbnRhbF9kZWZhdWx0Rm9ybVN0YXRlQmVoYXZpb3IiOnsiYXJyYXlNaW5JdGVtcyI6eyJwb3B1bGF0ZSI6InBvcHVsYXRlIiwibWVyZ2VFeHRyYURlZmF1bHRzIjpmYWxzZX0sImVtcHR5T2JqZWN0RmllbGRzIjoicG9wdWxhdGVBbGxEZWZhdWx0cyJ9LCJsaXZlVmFsaWRhdGUiOmZhbHNlfX0=

Schema:

{
  "title": "oneOf Example",
  "type": "object",
  "properties": {
    "status": {
      "$ref": "#/definitions/status"
    }
  },
  "definitions": {
    "status": {
      "title": "Field Status",
      "type": "object",
      "oneOf": [
        {
          "title": "Approved",
          "type": "object"
        },
        {
          "title": "Rejected",
          "type": "object",
          "properties": {
            "reason": {
              "title": "Rejection Reason",
              "type": "string"
            }
          }
        }
      ]
    }
  }
}

Environment

N/A?

Anything else?

The closest existing issues I could find to this are below, but none of them seem caused by the same problem as far as I can tell. In each of those cases, the dropdown text does update, whereas mine does not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions