-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
When passing form names dynamically, the inner component still shows the previous state #2303
Comments
Looks like the form changes but the onChange still uses the previous form name |
We have bumped into the exact same problem on 6.4.1. We're working on a form-heavy application which uses schema files to describe which input the API endpoints accept. It made sense to create a form generator which consumes these schema's. Everything works smoothly, except for this. Were you able to wire everything up correctly, @thanhvuong? |
It happens the same to me. I tested my implementation with two different pages, that means two different stateless components used to render instances of the same form and it works fine. I run into this error when I try to change the form with Therefore, it seems the current form and the state is lost. NOTE: One thing to keep in mind, it's that the fields inside of the form get updated in the current instance |
Any update on this bug, or workaround figured out? |
So I have found the following workaround: <div>
{[
<MyForm key={form} form={form} />
]}
</div> This works because using array item with varying |
@apendua, actually I did the same, but you don't even need to create an array: <div>
<MyForm key={form} form={form} />
</div> This will work as well. |
@just-boris I didn't know about that. Thanks! |
@apendua we tried that option in multiple ways. It did overwrite the fields but it didn't delete the previous state of the form in redux so we land in weird situations where the form lost consistency and stop working. we are using dynamically pass the option key an form by a selector in the same container component. something like
Personally, I think this is not solve, we needed it to use react-router to re-render the whole page when we select the form so we have now multiple forms files rather than an unique file which change the content. |
Because this issue saw almost no activity for a few months, I'm closing it. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
We're running into the same problem (but I'm on 6.3.2) posted by @just-boris on #603 (comment)
The text was updated successfully, but these errors were encountered: