@swiss-ai-hub/web 0.305.0 → 0.305.2

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 { merge } from 'lodash-es'
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,26 @@ 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
 
70
+ // Seed from `initialData` only once. A save refetches the query, so `initialData` becomes a new
71
+ // object; re-hydrating then would reassign `data`, which FormKit's `v-model` re-commits in a
72
+ // slightly different shape and reassigns again — an infinite render loop that froze the tab.
73
+ let formSeeded = !!(props.initialData && Object.keys(props.initialData).length > 0)
74
+
68
75
  watch(() => props.initialData, (newData) => {
76
+ if (formSeeded) return
69
77
  if (newData && Object.keys(newData).length > 0) {
70
- data.value = merge({}, data.value, hydrate(newData))
78
+ data.value = hydrate(newData)
79
+ formSeeded = true
71
80
  }
72
- }, { deep: true })
81
+ })
73
82
 
74
83
  const emit = defineEmits<{
75
84
  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.305.0",
6
+ "version": "0.305.2",
7
7
  "description": "Swiss AI Hub - Admin & Management UI (Nuxt 3 layer)",
8
8
  "main": "./nuxt.config.ts",
9
9
  "repository": {