You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Overriding the messages prop on a controlled Form component to provide a different validation message runs normally without observable exceptions.
Actual Behavior
When keying characters into an empty TextInput-based field in this scenario, React throws an exception to the console after the second character is entered. This occurs whether or not the TextInput field is wrapped by a FormField component or whether the field is even marked required.
Warning: Cannot update a component (`App`) while rendering a different component (`Form`). To locate the bad setState() call inside `Form`, follow the stack trace as described in https://fb.me/setstate-in-render
in Form (at App.js:13)
in div (created by StyledBox)
in StyledBox (created by Box)
in Box (at App.js:12)
in div (created by StyledGrommet)
in StyledGrommet (created by Grommet)
in Grommet (at App.js:11)
in App (at src/index.js:9)
in StrictMode (at src/index.js:8)
This behavior is observable on Grommet 2.12.0 w/React 16.13.1. The behavior does NOT occur when paired with React 16.12.
Note that if the messages prop is removed from the Form component the unwanted behavior no longer presents. And whether or not the exception is thrown the validation functionality actually appears to work (in this example overriding the message for a required field).
Try the example. Start typing into the input field and watch the console.
AFAICT this is a behavior introduced in React 16.13. Lots of related issues in the React repo, with solutions almost always required in the component libraries using it, which would seem to suggest a solution is required inside Grommet.
Expected Behavior
Overriding the messages prop on a controlled Form component to provide a different validation message runs normally without observable exceptions.
Actual Behavior
When keying characters into an empty TextInput-based field in this scenario, React throws an exception to the console after the second character is entered. This occurs whether or not the TextInput field is wrapped by a FormField component or whether the field is even marked required.
This behavior is observable on Grommet 2.12.0 w/React 16.13.1. The behavior does NOT occur when paired with React 16.12.
Note that if the messages prop is removed from the Form component the unwanted behavior no longer presents. And whether or not the exception is thrown the validation functionality actually appears to work (in this example overriding the message for a required field).
URL, screen shot, or Codepen exhibiting the issue
https://codesandbox.io/s/nervous-dubinsky-k7iul
Steps to Reproduce
Try the example. Start typing into the input field and watch the console.
AFAICT this is a behavior introduced in React 16.13. Lots of related issues in the React repo, with solutions almost always required in the component libraries using it, which would seem to suggest a solution is required inside Grommet.
See:
facebook/react#18178
WordPress/gutenberg#21049
reactive/data-client#300
Your Environment
The text was updated successfully, but these errors were encountered: