question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FormField doesn't work with CustomComponent after updating to v2.11.3

See original GitHub issue

Expected Behavior

FormField should work with CustomComponent

Actual Behavior

After updating to v2.11.3, after typing one character in a custom text input, I can no longer type any other character. After spending some time debugging, I noticed that by adding the value property to the Form component fixes it.

This, however, introduces a warning.

Warning: Cannot update a component (`Form`) while rendering a different component (`TextInput`). To locate the bad setState() call inside `TextInput`, follow the stack trace as described in https://fb.me/setstate-in-render

URL, screen shot, or Codepen exhibiting the issue

Screenshot 2020-03-30 at 03 08 04

You can try it out here https://codesandbox.io/s/grommet-sandbox-vso4c. Try removing the value from From and notices that you can no longer type in the CustomComponent

Steps to Reproduce

  1. Add a CustomComponent to a FormField
  2. Make sure value property is not set for the Form
  3. Try to type in the CustomComponent, this wouldn’t work.
  4. Add value to the Form component and you will be able to type
  5. Open your console, reload and type again
  6. You will see the warning message written above

Your Environment

  • Grommet version: 2.11.3
  • Browser Name and version: Chrome Version 80.0.3987.149 (Official Build) (64-bit)
  • Operating System and version (desktop or mobile): macOS Catalina version 10.15.3 (Desktop)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ericsoderberghpcommented, May 30, 2020

The warning in the above sandbox is due to: const [name, setName] = useState(); not specifying an initial value. If I change that line to be const [name, setName] = useState(''); instead, the warning is removed. This is due to name now having an initial value of ‘’ instead of undefined.

2reactions
hoshomohcommented, Apr 6, 2020

Any update on this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Grommet - custom component in FormField - Stack Overflow
Run the following and check out the console logs to see how the value is being updated as you type in the custom...
Read more >
joomla 3.x - Custom form field not working on server
I want to display the field as selectbox on server as well. joomla-3.x · custom-component · custom-field · Share.
Read more >
Turn Anything Into A Form Field With React Hook Form ...
Here we see the two props required to make our field component work with the Controller: value - It should show the current...
Read more >
Angular Custom Form Controls - Complete Guide
In this guide, we are going to learn exactly how to take an existing custom form control component and make it fully compatible...
Read more >
ASP.NET Core Blazor forms and input components
and HandleValidSubmit is not called. If the <input> form field contains more than ten characters when the Submit button is selected, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found