Skip to content
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: initialValue prop not used when input value is null #7133

Closed
wants to merge 3 commits into from

Conversation

thdk
Copy link
Contributor

@thdk thdk commented Jan 24, 2022

fixes #7132

I have replaced the lodash get method so that it is easier for maintainers / contributors to see what happens.
Lodash get will not use the default value when the result is null. While we need the initialValue to be returned for both null and undefined values as written in react admin docs. See docs for, the DateInput component.

@vercel vercel bot temporarily deployed to Preview – react-admin January 24, 2022 15:52 Inactive
@vercel vercel bot temporarily deployed to Preview – react-admin-storybook January 24, 2022 15:52 Inactive
packages/ra-core/src/form/useInput.ts Outdated Show resolved Hide resolved
@vercel vercel bot temporarily deployed to Preview – react-admin-storybook January 24, 2022 18:54 Inactive
@vercel vercel bot temporarily deployed to Preview – react-admin January 24, 2022 18:54 Inactive
@WiXSL WiXSL added this to the v3.19.8 milestone Jan 24, 2022
@WiXSL WiXSL added the RFR Ready For Review label Jan 24, 2022
@thdk
Copy link
Contributor Author

thdk commented Jan 24, 2022

@WiXSL I've just found out how to test it with the examples/simple project. Maybe wait with review untill I confirmed it is working as expected there.

@thdk
Copy link
Contributor Author

thdk commented Jan 24, 2022

@WiXSL Yep, I can confirm this is now working as expected!

packages/ra-core/src/form/useInput.ts Outdated Show resolved Hide resolved
@vercel vercel bot temporarily deployed to Preview – react-admin-storybook January 25, 2022 06:23 Inactive
@vercel vercel bot temporarily deployed to Preview – react-admin January 25, 2022 06:23 Inactive
@thdk thdk requested a review from WiXSL January 25, 2022 08:28
@WiXSL
Copy link
Contributor

WiXSL commented Jan 25, 2022

@thdk, So after discussion the solution is to fix the documentation, not the inputs.
So null value should be handled in userland.

@fzaninotto
Copy link
Member

Superseded by #7139

@fzaninotto fzaninotto closed this Jan 25, 2022
@thdk thdk deleted the fix/use-input-initial-value branch January 25, 2022 15:40
@WiXSL WiXSL removed this from the v3.19.8 milestone Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DateField: initialValue not working when value is null
3 participants