Default values from server and isDefaultValues not working as expected
Hi, I'm trying to implement unsaved changes feature in remix. I get default values from server and they are updated after form.handleSubmit. Yet isDefaultValue remains false. Similar to this issue https://github.com/TanStack/form/issues/1051
Any suggestions for a workaround. Or how to handle this bug/issue
GitHub
Form options are stale after submit · Issue #1051 · TanStack/form
Describe the bug I want to disable the submit button after the submission. I compare options.defaultValues and values from the store to determine whether they are equal. However, the next render af...
3 Replies
national-goldOP•2mo ago
currently solved by using
useEffect(() => {
form.reset(loaderData)
}, [loaderData, form])
ambitious-aqua•2mo ago
I’m on mobile, but you can do something like form.reset(value) inside the onSubmit handler
correct-apricot•2mo ago
That's what Luca suggested as well