@formisch/preact 0.9.4 → 0.9.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
@@ -558,6 +558,7 @@ function focus(form, config) {
558
558
  function getAllErrors(form) {
559
559
  let allErrors = null;
560
560
  walkFieldStore(form[INTERNAL], (internalFieldStore) => {
561
+ if (internalFieldStore.kind === "array") internalFieldStore.items.value;
561
562
  const errors = internalFieldStore.errors.value;
562
563
  if (errors) if (allErrors) allErrors.push(...errors);
563
564
  else allErrors = [...errors];
@@ -610,7 +611,15 @@ function insert(form, config) {
610
611
  const newItems = [...items];
611
612
  newItems.splice(insertIndex, 0, createId());
612
613
  internalArrayStore.items.value = newItems;
613
- for (let index = items.length; index > insertIndex; index--) copyItemState(internalArrayStore.children[index - 1], internalArrayStore.children[index]);
614
+ for (let index = items.length; index > insertIndex; index--) {
615
+ if (!internalArrayStore.children[index]) {
616
+ const path = JSON.parse(internalArrayStore.name);
617
+ internalArrayStore.children[index] = {};
618
+ path.push(index);
619
+ initializeFieldStore(internalArrayStore.children[index], internalArrayStore.schema.item, void 0, path);
620
+ }
621
+ copyItemState(internalArrayStore.children[index - 1], internalArrayStore.children[index]);
622
+ }
614
623
  if (!internalArrayStore.children[insertIndex]) {
615
624
  const path = JSON.parse(internalArrayStore.name);
616
625
  internalArrayStore.children[insertIndex] = {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formisch/preact",
3
3
  "description": "The modular and type-safe form library for Preact",
4
- "version": "0.9.4",
4
+ "version": "0.9.5",
5
5
  "license": "MIT",
6
6
  "author": "Fabian Hiller",
7
7
  "homepage": "https://formisch.dev",