File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -450,16 +450,27 @@ const $useForm = useForm({
450450});
451451
452452// ? Make sure to update the modelValue when the form values change //
453+ const internalUpdate = ref (false );
454+ let useFormValueTimer: ReturnType <typeof setTimeout >;
455+
453456watch (() => $useForm .values , (newVal ) => {
457+ internalUpdate .value = true ;
454458 modelValue .value = JSON .parse (JSON .stringify (newVal ));
455459
456460 callbacks ();
461+
462+ clearTimeout (useFormValueTimer );
463+ useFormValueTimer = setTimeout (() => {
464+ internalUpdate .value = false ;
465+ }, 0 );
457466}, { deep: true });
458467
459468watch (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+ }
463474}, { deep: true });
464475
465476
You can’t perform that action at this time.
0 commit comments