Skip to content

Issue with nested if...then conditions #4450

@anya92

Description

@anya92

Prerequisites

What theme are you using?

core

Version

5.24.1

Current Behavior

There is a problem with nested if...then conditions inside properties. With liveOmit and omitExtraData enabled, the value of a property that is displayed conditionally is automatically removed.

Here is the JSON schema I am testing:

{
  "type": "object",
  "properties": {
    "object": {
      "title": "Object",
      "type": "object",
      "properties": {
        "name": {
          "title": "Name",
          "type": "string"
        },
        "booleanProperty": {
          "title": "Boolean Property",
          "default": true,
          "type": "boolean"
        }
      },
      "if": {
        "properties": {
          "booleanProperty": {
            "const": true
          }
        }
      },
      "then": {
        "properties": {
          "otherProperty": {
            "title": "Other Property",
            "type": "string",
            "enum": [
              "Hello",
              "World"
            ]
          }
        },
        "required": [
          "otherProperty"
        ]
      }
    }
  }
}

When the booleanProperty is set to true, the otherProperty field is displayed in the form, but its value cannot be changed because it is automatically cleared.

Expected Behavior

The value of otherProperty should not be cleared when booleanProperty is set to true.

Steps To Reproduce

  1. Go to Playground.
  2. Try to change Other Property value.

Environment

- OS:
- Node:
- npm:

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions