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

Issue with nested if...then conditions #4450

Open
4 tasks done
anya92 opened this issue Jan 15, 2025 · 1 comment
Open
4 tasks done

Issue with nested if...then conditions #4450

anya92 opened this issue Jan 15, 2025 · 1 comment

Comments

@anya92
Copy link

anya92 commented Jan 15, 2025

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

@anya92 anya92 added bug needs triage Initial label given, to be assigned correct labels and assigned labels Jan 15, 2025
@heath-freenome
Copy link
Member

heath-freenome commented Jan 17, 2025

Essentially a re-open of #4109. @anya92 do you feel comfortable updating the fix the @helen-m-lin provided? Or maybe they can continue improving the fix?

@heath-freenome heath-freenome added help wanted and removed needs triage Initial label given, to be assigned correct labels and assigned labels Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants