Skip to content

Commit ac38be7

Browse files
committed
Update useForm.ts
1 parent 5adf9c9 commit ac38be7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/vue3/src/useForm.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,15 +441,18 @@ export default function useForm<TForm extends FormDataType<TForm>>(
441441
watch(
442442
form as any as InertiaForm<TForm> & RememberInternalState<TForm>,
443443
(newValue) => {
444-
const formValue = newValue
445-
formValue.isDirty = !isEqual(formValue.data(), defaults)
444+
newValue.isDirty = !isEqual(newValue.data(), defaults)
446445
if (rememberKey) {
447-
router.remember(cloneDeep(formValue.__remember()), rememberKey)
446+
router.remember(cloneDeep(newValue.__remember()), rememberKey)
448447
}
449448
},
450449
{ immediate: true, deep: true },
451450
)
452451

452+
if (!precognitionEndpoint) {
453+
return form
454+
}
455+
453456
// Vue's reactive() wrapper matches our interface at runtime
454457
const typedForm = form as any as InertiaForm<TForm>
455458

0 commit comments

Comments
 (0)