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

Closed
opened 2026-10-05 02:55:37 +02:00 by adam · 3 comments
Owner

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
**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 ``` 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** <img width="541" alt="Screenshot 2024-02-28 at 20 24 36" src="https://github.com/estruyf/vscode-front-matter/assets/411945/1e476097-7aaa-448c-b655-771fbe760894"> **Desktop (please complete the following information):** - OS: MacOS - Vscodium: 1.86.2 - Front Matter CMS: 10.0.0 <!-- github-sync-id:2159690840 -->
adam closed this issue 2026-10-05 02:55:37 +02:00
Author
Owner

Thanks for reporting this. A fix is on its way.

Thanks for reporting this. A fix is on its way. <!-- github-comment-id:1969809094 -->
Author
Owner

Version 10.0.1 has been published with the fix included.

Version 10.0.1 has been published with the fix included. <!-- github-comment-id:1969837124 -->
Author
Owner

@estruyf Thank you for the speedy fix. Just tested 10.0.1 and everything is working again 🙇

@estruyf Thank you for the speedy fix. Just tested 10.0.1 and everything is working again 🙇 <!-- github-comment-id:1969847772 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/vscode-front-matter#605