-
-
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
Using state on CreateButton will polute/break other Create components #9394
Comments
Also, tried to go around this by using the
does not work either because and that is because in this section while it might look like the url is correct by setting |
managed to create an example here i just added To reproduce: open the dev tools on the console tab
notice the |
Reproduced, thanks for the detailed report. So far I have no idea where this might come from, this will require some investigation work... |
The documentation mentions “clone” button that works the same. My guess is they will also trigger this bug. |
After inspection, this regression was introduced in 4.15.0 (#9319). Fix incoming. |
Glad you guys figure it out (looked a bit at the code bug was was a bit hard to follow through all of abstractions). |
What you were expecting:
according to https://marmelab.com/react-admin/Create.html#prefilling-the-form if in any context (for example show page of an item) i render a
This will only apply to the create form state if and only if i click this particular button.
What happened instead:
If i just visit the
show
page where this button is rendered, then go back to the main list of posts and click the add button (so the create form/page unrelated to comments), when clicking save, thedata
sent to the dataprovider (and ultimately to the api ) will contain thepost_id
field (invalid data which certain backends complain about with 400 bad request)sample code
This code is not really tested (encountered the error in my own setup with custom components) but i believe it will trigger the error.
If you just click the standard "Create" button (not the custom one), The submitted form will contain
post_id
filedIn essence, render a
CreateButton
with the state parameter and record set to something then go to any other create form (even unrelated) and the data submitted should contain the state from the custom create button.If it is not immediately obvious and easy to reproduce, let me know and i'll look into creating a example
The text was updated successfully, but these errors were encountered: