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
862 stars 43 forks source link

Widget `select` not loaded correctly #118

Closed samtrion closed 6 months ago

samtrion commented 6 months ago

Based on the following configuration, when I create a new Site or open a Page with explicit set value for heroAnchor is everything fine.

- label: Hero Anchor
  name: heroAnchor
  widget: select
  i18n: true
  preview: false
  options: ["TopLeft", "TopCenter", "TopRight", "Left", "Center", "Right", "BottomLeft", "BottomCenter", "BottomRight", "Smart"]
  default: "Smart"

However, when I open a page where heroAnchor has not been used previously, the default value is not applied correctly. For the sake of data consistency, an update to the stored data should be offered in this case.

kyoshino commented 6 months ago

I think the current behaviour is fine. The default value is supposed to be applied only to a new entry, and it seems working as expected. Changing existing entries is rather confusing, even if the value is not set.

Since the data source is static files in a Git repository, and those files could be updated by any means other than the CMS UI, data consistency cannot be guaranteed. It’s a limitation of Git-based CMSes.