@formisch/react 0.4.4 → 0.4.5

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.
Files changed (2) hide show
  1. package/dist/index.js +10 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -644,6 +644,7 @@ function focus(form, config) {
644
644
  function getAllErrors(form) {
645
645
  let allErrors = null;
646
646
  walkFieldStore(form[INTERNAL], (internalFieldStore) => {
647
+ if (internalFieldStore.kind === "array") internalFieldStore.items.value;
647
648
  const errors = internalFieldStore.errors.value;
648
649
  if (errors) if (allErrors) allErrors.push(...errors);
649
650
  else allErrors = [...errors];
@@ -700,7 +701,15 @@ function insert(form, config) {
700
701
  const newItems = [...items];
701
702
  newItems.splice(insertIndex, 0, createId());
702
703
  internalArrayStore.items.value = newItems;
703
- for (let index = items.length; index > insertIndex; index--) copyItemState(internalArrayStore.children[index - 1], internalArrayStore.children[index]);
704
+ for (let index = items.length; index > insertIndex; index--) {
705
+ if (!internalArrayStore.children[index]) {
706
+ const path = JSON.parse(internalArrayStore.name);
707
+ internalArrayStore.children[index] = {};
708
+ path.push(index);
709
+ initializeFieldStore(internalArrayStore.children[index], internalArrayStore.schema.item, void 0, path);
710
+ }
711
+ copyItemState(internalArrayStore.children[index - 1], internalArrayStore.children[index]);
712
+ }
704
713
  if (!internalArrayStore.children[insertIndex]) {
705
714
  const path = JSON.parse(internalArrayStore.name);
706
715
  internalArrayStore.children[insertIndex] = {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formisch/react",
3
3
  "description": "The modular and type-safe form library for React",
4
- "version": "0.4.4",
4
+ "version": "0.4.5",
5
5
  "license": "MIT",
6
6
  "author": "Fabian Hiller",
7
7
  "homepage": "https://formisch.dev",