fix: 修复ConfigForm和EmbeddingConfigForm组件watch死循环导致内存溢出 [AC-AISVC-50]
This commit is contained in:
parent
6c16132557
commit
3f1f4cd98d
|
|
@ -92,6 +92,7 @@ const emit = defineEmits<{
|
|||
|
||||
const formRef = ref<FormInstance>()
|
||||
const formData = ref<Record<string, any>>({})
|
||||
const isUpdating = ref(false)
|
||||
|
||||
const schemaProperties = computed(() => {
|
||||
return props.schema?.properties || {}
|
||||
|
|
@ -174,6 +175,7 @@ const initFormData = () => {
|
|||
watch(
|
||||
() => props.modelValue,
|
||||
(newVal) => {
|
||||
if (isUpdating.value) return
|
||||
if (JSON.stringify(newVal) !== JSON.stringify(formData.value)) {
|
||||
initFormData()
|
||||
}
|
||||
|
|
@ -192,8 +194,13 @@ watch(
|
|||
watch(
|
||||
formData,
|
||||
(val) => {
|
||||
if (isUpdating.value) return
|
||||
if (JSON.stringify(val) !== JSON.stringify(props.modelValue)) {
|
||||
isUpdating.value = true
|
||||
emit('update:modelValue', val)
|
||||
Promise.resolve().then(() => {
|
||||
isUpdating.value = false
|
||||
})
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ const emit = defineEmits<{
|
|||
|
||||
const formRef = ref<FormInstance>()
|
||||
const formData = ref<Record<string, any>>({})
|
||||
const isUpdating = ref(false)
|
||||
|
||||
const schemaProperties = computed(() => {
|
||||
return props.schema?.properties || {}
|
||||
|
|
@ -174,6 +175,7 @@ const initFormData = () => {
|
|||
watch(
|
||||
() => props.modelValue,
|
||||
(newVal) => {
|
||||
if (isUpdating.value) return
|
||||
if (JSON.stringify(newVal) !== JSON.stringify(formData.value)) {
|
||||
initFormData()
|
||||
}
|
||||
|
|
@ -192,8 +194,13 @@ watch(
|
|||
watch(
|
||||
formData,
|
||||
(val) => {
|
||||
if (isUpdating.value) return
|
||||
if (JSON.stringify(val) !== JSON.stringify(props.modelValue)) {
|
||||
isUpdating.value = true
|
||||
emit('update:modelValue', val)
|
||||
Promise.resolve().then(() => {
|
||||
isUpdating.value = false
|
||||
})
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
|
|
|
|||
Loading…
Reference in New Issue