@koumoul/vjsf 4.3.1 → 4.4.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koumoul/vjsf",
3
- "version": "4.3.1",
3
+ "version": "4.4.0",
4
4
  "description": "Generate forms for the vuetify UI library (vuejs) based on annotated JSON schemas.",
5
5
  "scripts": {
6
6
  "test-tz1": "TZ=Europe/Paris vitest run",
@@ -78,7 +78,7 @@
78
78
  "vuetify": "^4.0.0"
79
79
  },
80
80
  "dependencies": {
81
- "@json-layout/core": "~2.7.0",
81
+ "@json-layout/core": "~2.8.0",
82
82
  "@json-layout/vocabulary": "~2.13.0",
83
83
  "@vueuse/core": "^12.5.0",
84
84
  "debug": "^4.3.4"
@@ -115,6 +115,7 @@ export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compi
115
115
  }
116
116
 
117
117
  let lastDataUpdate
118
+ let lastEmittedData = toRaw(modelValue.value)
118
119
  /**
119
120
  * @param {any} data
120
121
  */
@@ -126,6 +127,7 @@ export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compi
126
127
  debug('onDataUpdate data changed while waiting for nextTick, do not emit')
127
128
  } else {
128
129
  debug(' -> emit update:modelValue', data)
130
+ lastEmittedData = data
129
131
  emit('update:modelValue', data)
130
132
  }
131
133
  }
@@ -190,6 +192,10 @@ export const useVjsf = (schema, modelValue, options, nodeComponents, emit, compi
190
192
  // case where data is updated from outside
191
193
  watch(modelValue, (newData) => {
192
194
  const rawData = toRaw(newData)
195
+ // ignore round-trips of values we just emitted: when async work (e.g. list getItems)
196
+ // mutates _data after an emit, the v-model echo of that emit can fire here later
197
+ // and would otherwise overwrite the newer internal state with stale data
198
+ if (rawData === lastEmittedData) return
193
199
  if (statefulLayout.value && statefulLayout.value.data !== rawData) {
194
200
  debug('modelValue changed from outside', rawData)
195
201
  debug(' -> update statefulLayout data')
@@ -1 +1 @@
1
- {"version":3,"file":"use-vjsf.d.ts","sourceRoot":"","sources":["../../src/composables/use-vjsf.js"],"names":[],"mappings":"AAcA;IACE;;MAEE;gCADO,GAAG;IAGZ;;MAEE;4BADO,OAAO,aAAa,EAAE,kBAAkB;EAGlD;AAiBM,gCAdI,OAAO,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,cACzB,OAAO,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,WACtB,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC,kBAClE,MAAM,CAAC,MAAM,EAAE,OAAO,KAAK,EAAE,SAAS,CAAC,QACvC,GAAG,YACH,cAAc,2BAA2B,EAAE,OAAO,0BAClD,cAAc,2BAA2B,EAAE,qBAAqB,sBAChE,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,mBAAmB,EAAE,cAAc,CAAC,GAC3D;IACV,EAAE,EAAE,OAAO,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5B,cAAc,EAAE,OAAO,KAAK,EAAE,UAAU,CAAC,OAAO,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC,CAAC;IAC1F,SAAS,EAAE,OAAO,KAAK,EAAE,UAAU,CAAC,OAAO,mBAAmB,EAAE,SAAS,GAAG,IAAI,CAAC,CAAA;CAChF,CAyKH"}
1
+ {"version":3,"file":"use-vjsf.d.ts","sourceRoot":"","sources":["../../src/composables/use-vjsf.js"],"names":[],"mappings":"AAcA;IACE;;MAEE;gCADO,GAAG;IAGZ;;MAEE;4BADO,OAAO,aAAa,EAAE,kBAAkB;EAGlD;AAiBM,gCAdI,OAAO,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,cACzB,OAAO,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,WACtB,OAAO,KAAK,EAAE,GAAG,CAAC,OAAO,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC,kBAClE,MAAM,CAAC,MAAM,EAAE,OAA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