-
-
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
FormWithRedirect is merging data from the background record #7483
Comments
Reproduced, thanks for submitting this! |
Hello @WiXSL , Just updated the version with 3.19.11 I can confirm that on 2 different pc, the behaviour is the same this is also a fork with react admin 3.19.11 and react 17.0.2 |
What about trying with react version 17 ? |
@WiXSL sorry just updated the answer :-) |
be careful to follow the steps, you are creating the comment, instead you need to update a comment (so a record already exist and is loaded in background) ;-) to be more clear: on this page, please |
@WiXSL can you please re-add the bug label? it's indeed a bug :-( |
I'm also facing this on latest 3.X version (3.19.11). As @fzan said, I also think this bug was introduced on this commit by wrapping the In order to isolate the error, I tested a custom FormContextProvider (just like the version pre-commited) without the wrapper, and it works fine. After reading conversation about the related commits on version 3.19.3, I noticed that @fzaninotto mentioned a |
With the release of react-admin v5, react-admin v3 has reached its end of life. We won't fix bugs or make any new release on the 3.x branch. We recommend that you switch to a more recent version of react-admin. So I'm closing this issue as we won't fix it. |
What you were expecting:
FormWithRedirect should read only the current form data
What happened instead:
FormWithRedirect read all the background record data then merge them in a single record
Steps to reproduce:
Go here:
https://codesandbox.io/s/react-admin-v3-advanced-recipes-quick-create-preview-forked-kefpy0?file=/src/comments/PostQuickCreateButton.js
on this page, please
0- Open developer tools :-)
a) navigate to /comments/1
b) click on "create"
c) add Title and Teaser
d) please note the console messages
Briefly, the FormWithRedirect component is submitting the two fields (title and teaser) but adding also the fields from comment
(body, created_at, id, post_id, teaser, title)
And that is obviously a problem because the post with id:1 already exist.
You can see that:
After 2 days of investigation (...) i noticed that on react@3.19.2 this problem is not happening.
My suspect went to
#6932
specifically related to this
https://github.com/marmelab/react-admin/pull/6932/files#diff-8535e4db04baeef00e2e572f5d575a7202403cdd652c8682082818f0dec7c62e
I'm sorry i cannot provide a fix, because this is beyond my knowledge of the framework :-(
I actually can only suggest a workaround:
Environment
in the sandbox
The text was updated successfully, but these errors were encountered: