File tree 1 file changed +14
-3
lines changed
1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -450,16 +450,27 @@ const $useForm = useForm({
450
450
});
451
451
452
452
// ? Make sure to update the modelValue when the form values change //
453
+ const internalUpdate = ref (false );
454
+ let useFormValueTimer: ReturnType <typeof setTimeout >;
455
+
453
456
watch (() => $useForm .values , (newVal ) => {
457
+ internalUpdate .value = true ;
454
458
modelValue .value = JSON .parse (JSON .stringify (newVal ));
455
459
456
460
callbacks ();
461
+
462
+ clearTimeout (useFormValueTimer );
463
+ useFormValueTimer = setTimeout (() => {
464
+ internalUpdate .value = false ;
465
+ }, 0 );
457
466
}, { deep: true });
458
467
459
468
watch (modelValue , (newVal ) => {
460
- Object .entries (newVal ).forEach (([key , value ]) => {
461
- $useForm .setFieldValue (key , value );
462
- });
469
+ if (! internalUpdate .value ) {
470
+ Object .entries (newVal ).forEach (([key , value ]) => {
471
+ $useForm .setFieldValue (key , value );
472
+ });
473
+ }
463
474
}, { deep: true });
464
475
465
476
You can’t perform that action at this time.
0 commit comments