estruyf / vscode-front-matter

Front Matter is a CMS running straight in Visual Studio Code. Can be used with static site generators like Hugo, Jekyll, Hexo, NextJs, Gatsby, and many more...
https://frontmatter.codes
MIT License
1.95k stars 77 forks source link

Issue: YAML Data files read but not written #743

Closed pauko closed 7 months ago

pauko commented 8 months ago

Describe the bug When using data files of type yaml in FrontMatter v9.4.0 and trying to enter data entries in the Data File View of the Dashboard, a given entry is not written to the (already existing, but empty) yaml file, although there is this little "pop-up window" shown in the top-right corner "Updated your data entries".

On the contrary, when I prefill in data in the yaml file manually, that data entry is listed in the Data File View, but adding new entries from FrontMatter's dashboard is still not possible.

Note: Writing data entries works as expected in case of json data files.

To Reproduce Steps to reproduce the behavior:

  1. reproduce the data file definition as listed in section Additional context
  2. create an empty activities.yaml file in the project root
  3. get to the Data File View of the FrontMatter dashboard
  4. select "Activitities" in column "Select your data type"
  5. enter same sample data in the Title edit box on the right
  6. click the Add button
  7. "Updated your data entries" appears on the top-right
  8. "Your activities data items" column remains empty, just showing "No activities data entries found"

Expected behavior The data entry is written to the specified data file and shown in the Data File View.

Additional context Data file definition in .frontmatter/config/data/files named activities.json (using the Splitting your settings in multiple files feature):

{
  "$schema": "https://frontmatter.codes/config/data.files.schema.json",
  "id": "activities",
  "title": "Activities",
  "file": "[[workspace]]/activities.yaml",
  "fileType": "yaml",
  "singleEntry": false,
  "labelField": "title",
  "schema": {
    "title": "Activity",
    "type": "object",
    "required": [
      "title"
    ],
    "properties": {
      "title": {
        "type": "string",
        "title": "Title"
      },
      "description": {
        "type": "string",
        "title": "Description"
      }
    }
  }
}
estruyf commented 8 months ago

Thanks, @pauko, for opening the issue. Found the issue, it had to do with an updated dependency and a function which was removed. I've implemented a fix in the beta and you should be able to test it out once released.