-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
#4053
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).
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 #3094 and #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]>
🦋 Changeset detectedLatest commit: 4028ab5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
<Form>
submit to not break formMethod
functionality
Co-authored-by: Michaël De Boey <[email protected]>
Co-authored-by: Michaël De Boey <[email protected]>
Co-authored-by: Michaël De Boey <[email protected]>
That’s odd. I’m confident the functionality is broken, but I was able to work around it. I’ll create a repro example, then try to see why the tests aren’t catching it. |
I can also confirm that this issue still occurs for me in the current release. |
I am facing the same issue in the current release. |
…orm.method options.method defaults to get so will always take precedent currently closes #4053 Signed-off-by: Logan McAnsh <[email protected]>
Until PR #4053 is merged in, you can use https://gist.github.com/kiliman/5a8dac031da8d545dc293fdcf82e9135 |
there's two solutions to this problem, the one provided by this PR and this. the issue is due to defaulting |
🤖 Hello there, We just published version Thanks! |
Closes: #2162 and #3613 (supersedes both) – credits to @mdoury and @nrako
DocsN/ATesting Strategy:
See integration Bug-Report-Test via commit: 37b0140
test: failing test with
<Form>
not respectingformMethod
06333c1 Thu, 30 Jun 2022 00:33:15 +0200fix(remix-react): submit
<Form>
w/method set by submitterformmethod
bfd1f88 Thu, 30 Jun 2022 00:32:22 +0200