Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Object widgets fields is required even when the object widget itself is not required #405

@Skrubbadubba

Description

@Skrubbadubba

Description
This happens to me sometimes, but not always. Based on some other behavior I observed with empty lists, my guess is that something triggers the object (don' know what, perhaps something to do with collapsing it) corresponding to the widget to be created. Once created, its fields cannot be left empty as the default for required is true, and thus the entry cannot be published.

Expected behaviour
If required: false and the object widget is left empty in the UI during creation, the entry should be created without raising the validation error toast and it should not contain the object (or at least an empty object).

Steps to reproduce
Here is what I'm working on: https://github.com/Skrubbadubba/static-cms-self-config. It's not a MRE for this particular bug, but it's minimal enough to be good for debugging. Clone it and run npm install && npm run dev && npx @staticcms/proxy-server.

  1. Create a new entry for the "Collections" collection.
  2. Enter a name and a label.
  3. Inside the "files" list widget there should be one empty object. For that object, enter file name and label.
  4. Publish the entry

These should be all the fields that do not have required: false

config.yml

I am not using yaml, but instead js and json. The relevant objects are in config/collections/metaCollection/collections.js, however the entire config object is console logged, it is probably easier to look through it there.
screenshot:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions