aws-amplify / aws-amplify/amplify-studio
React warning for update forms
- Dominant language
- No language data
- Stars
- 135
- Forks
- 32
- PR merge metrics
- No merged PRs in 30d
Description
### Before opening, please confirm:
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-adminui/issues?q=is%3Aissue+).
- [X] I have read the guide for [submitting bug reports](https://github.com/aws-amplify/amplify-adminui/blob/main/CONTRIBUTING.md#bug-reports).
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
### App Id
n/a
### Region
n/a
### Environment name
n/a
### Figma File Version (if applicable)
_No response_
### Amplify CLI Version
_No response_
### If applicable, what version of Node.js are you using?
_No response_
### What operating system are you using?
_No response_
### Browser type?
_No response_
### Describe the bug
If I have the following schema:
```
type Cat @model {
name: String
age: Int
}
```
and save a Cat with no name (I can because it's an optional field)
and then try to update the Cat with an auto-generated UpdateCatForm,
I get the following warning in the console:
```
A component is changing a controlled input to be uncontrolled. This is likely caused by the value changing from a defined to undefined, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component.
```
### Expected behavior
The form should handle nullish values coming from Dynamo gracefully.
### Reproduction steps
See description.
### Project Identifier
_No response_
### Additional information
_No response_
Contributor guide
Research direction
Start by reproducing the schema and generated UpdateCatForm described in the issue, then inspect how optional nullish values from Dynamo are passed to the form inputs. Done means updating a Cat saved without a name no longer produces the controlled-input warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100