-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(remix-react): fix <Form>
submit to not break formMethod
functionality
#3613
Conversation
Bug report integration test demonstrating how the `<Form>` component – unlike native `<form>` - does not respect the `formmethod` attribute set on the submitter (the `<button>` submitting the form).
<Form>
submit to not break formmethod
functionality<Form>
submit to not break formMethod
functionality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you maybe add the other tests from #2162 as well please?
Fix `<Form>` component by not passing the form's `method` into the `options` when calling the `submit(target, options)` function (created with the `useSubmit()` hook). This ensures that the option does not take precedence on any `formethod` set on the submitter which otherwise break the `formmethod` functionality. Since remix-run#3094 and remix-run#3094 the `<Form>` passes the "submitter" (if any) as the `target` to the `submit(target, options)` (`useSubmitImpl`) which will attempt to read the `formmethod`, `formaction` and `formenctype` attributes on the target. Therefore, the responsability to infer which method should be used should solely be on `useSubmitImpl` for the given `target`. Co-authored-by: Maxime Doury <[email protected]>
bfd1f88
to
9360e17
Compare
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
@MichaelDeBoey – could you please be a bit more explicit about the "other tests". The tests in this PR specifically cover what is fixed, which is to ensure that the Note: I've refactored the tests a bit, fixed the failing test, put the tests under a new |
Any movement on this? Is there any way I can help get this across the finish line? |
@MichaelDeBoey – well yes, but as I mentioned:
I personally don't believe that it is the responsibility of this PR to add tests coverage for something which is unrelated to what this PR fix and is also already covered by other tests. But feel free to add them, Remix's maintainers have edit privilege on my PR/branch. If I get a quick reply that can change my mind I might try to follow up on it but to get expectation clear, I'll soon be off for vacations. |
If someone can give me some instructions on how I can make these changes, I'd be happy to make them so this can get merged. This is functionality that I desperately need for my project. |
Closing this one in favor of #4053 |
Closes: #2162 (supersede) – credits to @mdoury for his original PR
DocsN/ATesting Strategy:
See integration Bug-Report-Test via commit: 37b0140
test: failing test with
<Form>
not respectingformMethod
06333c1 <Nicholas Rakoto> Thu, 30 Jun 2022 00:33:15 +0200
fix(remix-react): submit
<Form>
w/method set by submitterformmethod
bfd1f88 <Nicholas Rakoto> Thu, 30 Jun 2022 00:32:22 +0200