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

Multiple forms on a single page

Open jkehler opened this issue 1 year ago • 1 comments

I'm using multiple forms on an account settings page. Eg one for updating user details, and another form for changing the password.

So I'm defining 2 useRemixForm variables for each form. This all works fine. However, I'm using the form.formState.isSubmitting to show a loader. I noticed that both of my forms loading state is being triggered even though I'm only submitting one of them.

jkehler avatar May 02 '24 09:05 jkehler

I was able to work around the issue by passing a fetcher instead and then adding checks on the fetcher formData to determine which action is being triggered.

jkehler avatar May 02 '24 09:05 jkehler

@jkehler that would be the best way to solve the issue, the isSubmitting function checks if the navigation.state !== "idle" which is true for both forms, fetchers obviously allow you to be more flexible here. They would have their own submission states and allow for checking this!

AlemTuzlak avatar Jun 20 '24 07:06 AlemTuzlak