Skip to content

Issue: Field conditions does not honor default values #872

@pottekkat

Description

@pottekkat

Describe the bug

I created a field like this:

{
  "title": "Table of contents (ToC)",
  "name": "toc",
  "type": "fields",
  "fields": [
    {
      "title": "Show ToC?",
      "name": "show",
      "type": "boolean",
      "default": true
    },
    {
      "title": "Open ToC?",
      "name": "open",
      "type": "boolean",
      "default": true,
      "when": {
        "fieldRef": "show",
        "operator": "eq",
        "value": true
      }
    }
  ]
}

The idea is to show the "Open ToC?" field only if ToC is enabled.

When I disable "Show ToC?" and enable it again, I expect the value of "Open ToC?" to also be enabled because the default value is true. In the UI, it is shown as true but in the front matter, the field is missing.

To Reproduce
Steps to reproduce the behavior:

  1. Create a field as in the example
  2. Toggle "Show ToC?" to false
  3. Toggle "Show ToC?" to true
  4. Now in the GUI, the value of "Open ToC?" will be true but that field will be missing in the front matter.

Expected behavior

I expect the GUI and the front matter to be the same.

Now I have to toggle "OpenToC" to false and then true to enable it.

Device:

  • OS: [e.g. iOS] macOS
  • Front Matter CMS Version [e.g. 10.2.0] 10.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions