Skip to content

Issue: Defaults on snippets fields cannot be empty or null #766

Closed
@scottsweb

Description

@scottsweb

Describe the bug

Snippet forms are not rendering correctly when the default value is nothing "" or null – both of which used to be valid.

To Reproduce
Create the following snippet in frontmatter.json

    "Quote": {
      "description": "Quote with author",
      "body": [
        "<blockquote>",
        "  <p>[[quote]]</p>",
        "  <figcaption>— [[author]], <cite><a href=\"[[&url]]\">[[cite]]</a></cite></figcaption>",
        "</blockquote>"
      ],
      "fields": [
        {
          "name": "quote",
          "title": "Quote",
          "type": "string",
          "single": false,
          "default": "FM_SELECTED_TEXT"
        },
        {
          "name": "author",
          "title": "Author",
          "type": "string",
          "single": true,
          "default": ""
        },
        {
          "name": "cite",
          "title": "Cite",
          "type": "string",
          "single": true,
          "default": ""
        },
        {
          "name": "url",
          "title": "Cite URL",
          "type": "string",
          "single": true,
          "default": ""
        }
      ]
    }

Expected behavior

The default: value should be able to be an empty value. Setting it to be "" or null or removed causes the form not to render.

Screenshots

Screenshot 2024-02-28 at 20 24 36

Desktop (please complete the following information):

  • OS: MacOS
  • Vscodium: 1.86.2
  • Front Matter CMS: 10.0.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