@swiss-ai-hub/web 0.304.1 → 0.305.1
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.
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
type FormElement,
|
|
48
48
|
type RepeaterConfig,
|
|
49
49
|
} from '@core/composables/form/useFormKitTransform'
|
|
50
|
-
import {
|
|
50
|
+
import { cloneDeep } from 'lodash-es'
|
|
51
51
|
|
|
52
52
|
import type { FormkitElement } from '@core/sdk/client'
|
|
53
53
|
import type { FormKitSchemaDefinition } from '@formkit/core'
|
|
@@ -59,17 +59,19 @@ const props = defineProps<{
|
|
|
59
59
|
initialData?: Record<string, unknown>
|
|
60
60
|
}>()
|
|
61
61
|
|
|
62
|
+
// Clone so the form model never shares references with the Pinia-Colada cache: otherwise
|
|
63
|
+
// FormKit's write-backs mutate the cached object and the watcher loops on its own mutations.
|
|
62
64
|
function hydrate(raw: Record<string, unknown>): Record<string, unknown> {
|
|
63
|
-
return hydrateFormData(raw, props.form as FormElement[])
|
|
65
|
+
return hydrateFormData(cloneDeep(raw), props.form as FormElement[])
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
const data = ref<Record<string, unknown>>(hydrate(props.initialData || {}))
|
|
67
69
|
|
|
68
70
|
watch(() => props.initialData, (newData) => {
|
|
69
71
|
if (newData && Object.keys(newData).length > 0) {
|
|
70
|
-
data.value =
|
|
72
|
+
data.value = hydrate(newData)
|
|
71
73
|
}
|
|
72
|
-
}
|
|
74
|
+
})
|
|
73
75
|
|
|
74
76
|
const emit = defineEmits<{
|
|
75
77
|
submit: [Record<string, unknown>]
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"license": "AGPL-3.0-or-later",
|
|
4
4
|
"author": "bbv Software Services AG (https://www.bbv.ch)",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.305.1",
|
|
7
7
|
"description": "Swiss AI Hub - Admin & Management UI (Nuxt 3 layer)",
|
|
8
8
|
"main": "./nuxt.config.ts",
|
|
9
9
|
"repository": {
|