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

FormField triggers errors when it has null as a child #7180

Closed
kariwhitcomb opened this issue Mar 29, 2024 · 0 comments · Fixed by #7181
Closed

FormField triggers errors when it has null as a child #7180

kariwhitcomb opened this issue Mar 29, 2024 · 0 comments · Fixed by #7181
Labels
bug issue that does not match design or documentation and requires code changes to address

Comments

@kariwhitcomb
Copy link

Expected Behavior

We have code similar to this (without the explicit false)

<FormField>
        <TextInput />
        {false && <Text>foobar</Text>}
</FormField>

In v2.35.0 this would render fine with just the TextInput inside the form field

Actual Behavior

In v2.36.0 and v2.36.1 this code results in an error: 'Cannot read properties of null (reading 'props')'
It is failing around this line in FormField:

(child.props?.readOnly === true ||

URL, screen shot, or Codepen exhibiting the issue

https://codesandbox.io/p/sandbox/determined-noyce-yjhfjg?file=%2Fsrc%2FApp.js

Steps to Reproduce

  1. Have a FormField with a null or false child

Your Environment

  • Grommet version: v2.36.0 and v.2.36.1 (verified issue is present in both these versions)
  • Browser Name and version: Chrome
  • Operating System and version (desktop or mobile): Mac
@britt6612 britt6612 mentioned this issue Mar 29, 2024
3 tasks
@britt6612 britt6612 added bug issue that does not match design or documentation and requires code changes to address regression An issue reporting a regression or a PR that fixes a regression and removed regression An issue reporting a regression or a PR that fixes a regression labels Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issue that does not match design or documentation and requires code changes to address
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants