-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Reset record-form not triggered on Create #2129
Comments
Can you please add more details to your issue? What reset, when? There is an issue template, please use it. I'll close this issue otherwise |
Sure. What you were expecting: What happened instead: How to fix: |
Thanks for reporting, I'll check it out |
I can't reproduce it on the simple example. Can you setup a codesandbox showing the issue ? |
Open https://vv8o823zzl.codesandbox.io/#/posts (https://codesandbox.io/s/vv8o823zzl) |
There are some messed up dependencies on your codesandbox. I fixed them on this one: https://codesandbox.io/s/3rl5r7291p and can't reproduce your issue |
Nope it's still here: Tested in Chrome, Firefox |
Ah I finally reproduced it! Can you confirm it only happens when you navigate directly to the edit page (not from the list to the edit) before going to create? |
This is really weird. I can't reproduce it locally on the simple example |
I'm sorry for delay. It doesn't reset on any route change except Edit. May be related to redux-form/redux-form#4160 and redux-form/redux-form#4152 |
@djhi I just want to add that when you fill up the create form (posts in the sandbox above) but don't submit it (just go directly to comments list) and then when you open create post form again it "remembers" previously filled data. Is this an expected behaviour? In my project it happens also between non-related forms. |
I ran into the same problem. I my case, I submitted
after that, react-admin make a request with the recently created id and then my server return this
the first create was success but as I filled another info, let say,
and submitted again, it failed due to id duplication. When I tap redux to investigate, it was because record-form only clear 'name' value, the previously created info that has returned from the server (id, created, modified) was still there, so instead of sending {name: "anotherThing"} as I expected, this is what it sent to the server on the second submission.
How to make react-admin submit only the values available in filling form and not the returned items ? |
I have the same exact problem. When I have let's say two entities A & B:
If I modify entity A, everything goes smooth, but when I want to modify entity B, via the interface (changing menu, clicking on edit or create), I have a "internal server error" A little investigation shows me that when submitting B form, I have something like:
Showing that form is not reset correctly. I did not change anything before it happened so I guess this is a lib upgrade bug. I tried to downgrade every lib I had, but nothing does the trick... |
I have confirmed that this only happen if the form redirection target was 'edit'. If you don't pass any redirect props to the form, it is, by default, redirect to 'edit'. Current workaround is to pass form redirect anywhere (show or create) except edit
This works for me. Still cannot figure out the reason why. |
It seems to me that this commit introduced the bug: 05c0ecc I have solved it for me by downgrading |
Yes I think so. |
Yes you can downgrade |
Hmmf, I tried it and it doesn't seem to work :/
With |
My temporary fix: resetForm.js
<Admin |
I'll check for that use case then |
Thanks for reminding me about this usecase @nik-lampe. I finally fixed all of them in #2186 ! |
Reset record-form not triggered on Create
Environment
The text was updated successfully, but these errors were encountered: