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

Null default value becomes blank string #8264

Closed
damir-manapov opened this issue Oct 15, 2022 · 1 comment · Fixed by #8262
Closed

Null default value becomes blank string #8264

damir-manapov opened this issue Oct 15, 2022 · 1 comment · Fixed by #8262

Comments

@damir-manapov
Copy link

What you were expecting:
I am expecting to get null value from form state when null default value is set.

What happened instead:
Blank string from form state returns.

Steps to reproduce:

  1. Set default field value fo null
  2. Get field value

Related code:
Set default value:

<SimpleForm
  defaultValues={{
    field: null,
  }}
>

Use it:

<FormDataConsumer>
  {({formData}) => (
    <div>
      field: {JSON.stringify(formData.field)}
    </div>
  )}
</FormDataConsumer>

Result is:

field: ""

Environment

  • React-admin version: 4.4.1
  • Last version that did not exhibit the issue (if applicable): 4.3.0
  • React version: 18.2.0
  • Browser: Chrome 106.0.5249.119
@WiXSL
Copy link
Contributor

WiXSL commented Oct 15, 2022

Yes. It's a work in progress #8262

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants