sveltia / sveltia-cms

Alternative to Netlify/Decap CMS. Fast, lightweight, Git-based headless CMS. Modern UX, first-class i18n support, open source & free. Made with Svelte.
MIT License
726 stars 33 forks source link

Widget `relation`, default value not set, if `multiple` is `true` #117

Closed samtrion closed 3 months ago

samtrion commented 3 months ago

When I use the following configuration, the default value is not taken for new posts. If I set multiple to false, it works as aspected.

- label: Authors
  name: authors
  widget: relation
  i18n: duplicate
  collection: data-authors
  value_field: "id"
  search_fields: ["id", "name"]
  display_fields: ["name"]
  multiple: true
  min: 1
  max: 3
  default: "default"
kyoshino commented 3 months ago

I think, when multiple: true, the proper configuration would be default: ['default'] (an array) just like the List and Select widgets. But it’s not working in the current version of Sveltia. Will fix.

kyoshino commented 3 months ago

Just shipped v0.13.1 to address this and other issues 🩹