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
Fix null value support in inputs #8262
Merged
Merged
Changes from 27 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
ff41d83
Fix null value support in inputs
slax57 a5d2720
remove useless format prop
slax57 39657d3
Add more tests
fzaninotto 95e03aa
Handle undefined values, too
fzaninotto 43df168
No need for format as it is already in useInput
fzaninotto 83a5b76
Add more tests to SelectIInput
fzaninotto aafc64e
AutocompleteInput
slax57 c9e3879
extract FormInspector
slax57 41bd57f
DateInput
slax57 7b58efc
DateTimeInput
slax57 b8b5c9a
TimeInput
slax57 0928ac3
FileInput
slax57 9014786
ImageInput
slax57 ce222d4
SelectInput
slax57 2da082e
NullableBooleanInput
slax57 0f3fba7
RadioButtonGroupInput
slax57 ebe1575
RichTextInput
slax57 626cf59
move default parse to useInput
slax57 a66f05c
update sanitizeEmptyValues to handle null
slax57 ace29f3
[no ci] update doc
slax57 6aa5c03
add test about default parse in useInput
slax57 4af3f8f
rollback useless change
slax57 a1b89bc
remove unused parse in textinput
slax57 a418c55
Update Parse and format doc
fzaninotto 748cd23
Fix input doc tranform tutorial
fzaninotto 9d163d3
rewrite sanitizeEmptyValues doc
fzaninotto d1ff5f3
Remove useless defaultValue in SelectInput and AutocompleteInput
fzaninotto c1010cf
fix Inputs.md regarding sanitizeEmptyValues
slax57 e3b5d68
update sanitizeEmptyValues story and test
slax57 8c82a02
update sanitizeEmptyValues docs
slax57 413cd6b
document uncontrolled warning in custom inputs
slax57 ea943fe
fix linter warning
slax57 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I don't understand why you updated this function
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.
For react-admin inputs (such as TextInput), when the field is
undefined
from the dataProvider:'foo'
then back to''
)=> In both cases we will send
"field": null
, although the field was absent from what the dataProvider returned.This is because sanitizeEmptyValues only triggers on
''
but not onnull
, however our components now returnnull
.IMO in this case sanitizeEmptyValues should still remove the values from what's been sent (hence my change of the implementation is needed).
I'll add a story to play with this to the branch in any case so that you can see for yourself 😉