-
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
tests(remix-react): add failing test for default Form
action
#3211
Conversation
Hi @ionut-botizan, Welcome, and thank you for contributing to Remix! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected]. Thanks! - The Remix team |
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
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.
A few changes needed before we can merge. If an action value of .
is provided, it is correct to strip the search params when resolving the route path. We only need to preserve the location's search if no action is provided.
Preserve the current location's search params when the default Form action is used.
Now that the fix has been applied, the passing tests have been moved to `integration/form-test` and the template has been reverted.
Form
action
Please someone resolve and merge this PR. Always having to do this feels so daft. const { pathname, search } = useLocation();
return <Form action={pathname+search} |
Hey guys! Are there any other changes or additions that you would like me to provide? I think I did everything that was asked in the initial review... |
Hi @ionut-botizan, sorry for the radio silence on this one. We actually have duplicated efforts a bit on this bug. We are building Remix's form components and hooks into React Router, so @brophdawg11 and I have been working in tandem on that separately. I think I must have forgotten about your work and started my own over in #3697. Very sorry about that. To clean things up, I'm going to close this one. But I added you as a co-committer for |
Issue: #3133
The default
<Form />
action should match the current location. Currently, only thepath
is preserved, but thesearch
parameters are lost.E.g. For the
/login?redirectTo=/profile
location and a<Form method="post" />
element, the generated form node looks like<form method="post" action="/login">
.