From 0cfddf531149b937cb9f864167773b42d6fd81bb Mon Sep 17 00:00:00 2001 From: F A Date: Thu, 28 Aug 2025 16:19:09 -0400 Subject: [PATCH 1/4] fix: reactivity issue where values are overridden when schema updates --- src/components/Form.ts | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/components/Form.ts b/src/components/Form.ts index 8e597e8..86383b2 100644 --- a/src/components/Form.ts +++ b/src/components/Form.ts @@ -240,7 +240,6 @@ export const Form = defineComponent({ props.formioform, props.onFormReady, props.formReady, - props.form, props.src, props.options, props.url, @@ -253,6 +252,28 @@ export const Form = defineComponent({ }, ); + // Handle form schema updates intelligently + watch( + () => props.form, + (newForm, oldForm) => { + if (instanceIsReady.value && formInstance.value && newForm && oldForm) { + // Update the form schema without recreating the instance + formInstance.value.form = newForm; + // Trigger a rebuild to apply schema changes + formInstance.value.build(); + } else if ( + instanceIsReady.value && + formInstance.value && + newForm && + !oldForm + ) { + // Initial form load + formInstance.value.form = newForm; + } + }, + { deep: true }, + ); + watch( () => [ instanceIsReady.value, From e118437ddf3dc51fb55ba633ccc43d57ce684fb4 Mon Sep 17 00:00:00 2001 From: F A Date: Thu, 28 Aug 2025 16:19:29 -0400 Subject: [PATCH 2/4] fix: removed ungap dependencies --- package.json | 3 ++- src/components/Form.ts | 2 +- src/components/FormBuilder.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index f83d2f8..b4a4ee5 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "@formio/js": "5.0.0-rc.69", "@types/node": "^18.17.5", "@types/vue": "^2.0.0", + "@types/lodash": "^4.14.202", "@vue/compiler-sfc": "^3.4.15", "typescript": "^5.3.3", "typescript-eslint-parser": "^22.0.0", @@ -45,6 +46,6 @@ "dist" ], "dependencies": { - "@ungap/structured-clone": "^1.2.0" + "lodash": "^4.17.21" } } diff --git a/src/components/Form.ts b/src/components/Form.ts index 86383b2..69d0cd7 100644 --- a/src/components/Form.ts +++ b/src/components/Form.ts @@ -1,6 +1,6 @@ import { defineComponent, ref, onMounted, onBeforeUnmount, watch, CSSProperties, PropType, Prop, toRefs, toRaw } from 'vue'; import { EventEmitter, Form as FormClass, Webform } from '@formio/js'; -import structuredClone from '@ungap/structured-clone'; +import { cloneDeep as structuredClone } from 'lodash'; import { FormConstructor, FormHandlers, FormProps, FormSource } from '../types'; import useFormioRef from '../composables/useFormioRef'; diff --git a/src/components/FormBuilder.ts b/src/components/FormBuilder.ts index ef398e3..0a2626d 100644 --- a/src/components/FormBuilder.ts +++ b/src/components/FormBuilder.ts @@ -1,7 +1,7 @@ import { defineComponent, h, onMounted, onBeforeUnmount, ref, watch, PropType, toRaw } from 'vue'; import { FormBuilder as FormioFormBuilder } from '@formio/js'; import { Component } from '@formio/core'; -import structuredClone from '@ungap/structured-clone'; +import { cloneDeep as structuredClone } from 'lodash'; import { FormBuilderHandlers, FormBuilderProps, FormType } from '../types'; import useFormioRef from '../composables/useFormioRef'; From f1eb8f92fb01183089d9411e02408f4d527a05ad Mon Sep 17 00:00:00 2001 From: F A Date: Thu, 28 Aug 2025 16:28:51 -0400 Subject: [PATCH 3/4] fix: missing value --- src/components/Form.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Form.ts b/src/components/Form.ts index 69d0cd7..2d54cad 100644 --- a/src/components/Form.ts +++ b/src/components/Form.ts @@ -260,7 +260,7 @@ export const Form = defineComponent({ // Update the form schema without recreating the instance formInstance.value.form = newForm; // Trigger a rebuild to apply schema changes - formInstance.value.build(); + formInstance.value.build(formioRef.value); } else if ( instanceIsReady.value && formInstance.value && From 62bbf99533fd97fa9d3df9fb243d45d8c6675d2e Mon Sep 17 00:00:00 2001 From: F A Date: Thu, 28 Aug 2025 16:29:02 -0400 Subject: [PATCH 4/4] adds vite dev --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index b4a4ee5..d98bb1d 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "type": "module", "scripts": { "build": "vite build && tsc", + "dev": "vite build --watch", "prepublish": "npm run build" }, "repository": {