-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Opt out sanitizeEmptyValues with SimpleForm and TabbedForm #5077
Opt out sanitizeEmptyValues with SimpleForm and TabbedForm #5077
Conversation
a7bc1a8
to
2d35f6c
Compare
2d35f6c
to
11296e4
Compare
11296e4
to
c4a4389
Compare
It looks to me we would add yet another prop for something you can already handle at either the dataProvider level or by using the transform prop available on the Am I missing something? |
Indeed, we could remove the null values with a My problem is that I want to keep user-defined null values, but remove the one guessed by React Admin. EDIT: I would agree open a new PR if there is a simplest and/or more elegant way to resolve this problem! |
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.
Looking good to me!
Co-authored-by: Francois Zaninotto <fzaninotto@gmail.com>
Thanks! |
This is a good step towards supporting JSON fields, but there is another problem that I already wrote about and not solved.
instead
please add changes to the file
|
I think the best solution would be to allow using
instead of That would be as flexible as possible. your decision reserves other restrictions.
|
@wmwart Thanks for reporting the warning! It should be fixed with #5143 About make the sanitation even more customizable, the argument above is that, after opted-out from the default sanitation, you can come with your custom one on a "transform", if I understand well. |
Because final-form removes empty / null attributes, SimpleForm needs to recreate them with a
null
value from its initial values.This is a good default as most REST APIs requires all the fields.
That said, in particular cases, it might conflicts with expected attributes removal, for example:
Moreover, GraphQL APIs don't require all nullable fields to be present in the query.
A workaround would be to create your own form and coping the behavior of
<FormWithRedirect>
(that's what I did in the meanwhile), but I think this is a common enough case, and I this is a good opportunity to document this behavior.Feel free to edit the PR!
Closes #5043 and #4942