Field rule applies also for nested component fields

I have…

  • Read the following guideline: Troubleshooting and Support | Squidex. I understand that my support request might get deleted if I do not follow the guideline.
  • Used code blocks with ``` to format my code examples like JSON or logs properly.

I’m submitting a…

  • Regression (a behavior that stopped working in a new release)
  • Bug report
  • Performance issue
  • Documentation issue or request

Current behavior

When I configure hide rule for any component type field, this rule also called for every nested field, but with different “data” object

Because of this, a hiding rule like data.condition !== ‘a’ works correctly for data that has a “condition” field. But for nested fields this condition always returns true

Expected behavior

“sub-value” field should not be hidden by the rule. The rule should not be called for it.

I think problem in this code https://github.com/Squidex/squidex/blob/856709e667814402aeba251e5d7b882df92478f4/frontend/src/app/shared/state/contents.form-rules.ts#L180

This function calls with “path” = “value.sub-value” and I assume that this function should clear “.iv” part, but returns “value” as path. Because of this, the rule intended for “value” field twice.

Minimal reproduction of the problem

{
    "type": "Component",
    "fields": [{
        "name": "condition",
        "properties": {"fieldType": "String", "editor": "Radio", "allowedValues": ["a", "b"]}
    }, {
        "name": "value",
        "properties": {"fieldType": "Component", "schemaIds": ["77023cb5-7b95-4fe7-9dc8-35882a1b1fcc"]}
    }],
    "fieldRules": [{
        "action": "Hide", "field": "value",
        "condition": "(() => {console.log(data); return data.condition !== 'a'})()"
    }]
},
{
    "type": "Component"
    "schemaId": "77023cb5-7b95-4fe7-9dc8-35882a1b1fcc",
    "fields": [ {
        "name": "sub-value",
        "properties": { "fieldType": "Number" }
    }]
}

Environment

App Name:

  • Self hosted with docker
  • Self hosted with IIS
  • Self hosted with other version
  • Cloud version

Version: 7.9.0

Browser:

  • Chrome (desktop)
  • Chrome (Android)
  • Chrome (iOS)
  • Firefox
  • Safari (desktop)
  • Safari (iOS)
  • IE
  • Edge

Good point, but not sure how to fix it without loosing backwards compatibility.