@overmap-ai/forms 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1467,16 +1467,23 @@ var __publicField = (obj, key, value) => {
1467
1467
  };
1468
1468
  const uncontrolledValues = [null, void 0];
1469
1469
  const initialFormValues = (fields, values) => {
1470
- return fields.reduce((acc, field) => {
1471
- if (field instanceof FieldSection) {
1472
- return { ...acc, ...initialFormValues(field.fields, values) };
1473
- }
1474
- const copy = cloneDeep(acc);
1475
- if (uncontrolledValues.includes(get(copy, field.getId()))) {
1476
- set(copy, field.getId(), "");
1477
- }
1478
- return copy;
1479
- }, values);
1470
+ return fields.reduce(
1471
+ (acc, field) => {
1472
+ if (field instanceof FieldSection) {
1473
+ return { ...acc, ...initialFormValues(field.fields, values) };
1474
+ }
1475
+ if (uncontrolledValues.includes(get(acc, field.getId()))) {
1476
+ set(acc, field.getId(), "");
1477
+ }
1478
+ return acc;
1479
+ },
1480
+ // TODO: Had to do this because of this error:
1481
+ // > Uncaught TypeError: can't define property "description":
1482
+ // > Object is not extensible"
1483
+ // This means that we can't mutate `acc` because it's frozen for some
1484
+ // unknown reason.
1485
+ cloneDeep(values)
1486
+ );
1480
1487
  };
1481
1488
  const defaultHandleSubmit = () => {
1482
1489
  throw new Error("onSubmit must be provided if form is not readonly.");