remix-hook-form icon indicating copy to clipboard operation
remix-hook-form copied to clipboard

Automatically reset form on valid submission / loader revalidation

Open tobimori opened this issue 8 months ago • 2 comments
trafficstars

I tried overriding the submitHandlers, but this stops submission entirely (no way to call the default plugin handler) - kind of lost here.

I don't redirect after an action, so I assumed this should be support (conform works with it, but has other bigger issues)...

Maybe related to #148

tobimori avatar Feb 27 '25 23:02 tobimori

of course, smth like this could work:

useEffect(() => form.reset(loaderData), [form.reset, loaderData])

but that's ugly. nobody wants useEffect in their codebase 😄

tobimori avatar Feb 27 '25 23:02 tobimori

I mean the useEffect would just get moved to this lib instead, what would be the expected API for this, a config options like: { removeOnSubmit: true } ?

AlemTuzlak avatar Apr 03 '25 15:04 AlemTuzlak