Skip to content

Commit

Permalink
fix: πŸ› setFieldValue now updates inputValue on SQFormAutocomple
Browse files Browse the repository at this point in the history
setFieldValue was only updating the initialValue of SQFormAutocomplete
so the visible TextField would not reflect the change.

βœ… Closes: #144
  • Loading branch information
Laurel Bean committed Mar 19, 2021
1 parent ec2bc00 commit c6c4a4e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/SQForm/SQFormAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ function SQFormAutocomplete({
const [inputValue, setInputValue] = React.useState('');
const prevValue = usePrevious(value);

React.useEffect(() => {
setInputValue(initialValue?.label || '');
}, [initialValue]);

React.useEffect(() => {
// Form Reset
if (prevValue && inputValue && !value) {
Expand Down

0 comments on commit c6c4a4e

Please sign in to comment.