firecmsco / firecms

Awesome Firebase/Firestore-based CMS. The missing admin panel for your Firebase project!
https://firecms.co
Other
1.15k stars 184 forks source link

[bug] Unable to clear the value of an optional enum field #508

Closed SimpleCreations closed 1 year ago

SimpleCreations commented 1 year ago

The following bug can be observed when specifying an enum field which is not required. Upon clearing the field with the clear button and saving the entity, a validation message can be seen reporting that the value doesn't match any of the enum IDs. However, since the field is not required, undefined/null should be accepted.

Field configuration

  {
    name: "My enum",
    dataType: "string",
    enumValues: {
      value1: "Value 1",
      value2: "Value 2",
    },
    validation: { required: false },
    clearable: true,
  }

Expected behavior

When pressing the X button and saving the entity, the entity should get saved without errors.

Actual behavior

Before clearing:

Screenshot 2023-06-16 at 11 57 39

After clearing and saving:

Screenshot 2023-06-16 at 11 58 21
fgatti675 commented 1 year ago

Thank you! We will check it

fgatti675 commented 1 year ago

Fixed in version v2.0.4 :)