-
Notifications
You must be signed in to change notification settings - Fork 82
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
change select menus with Autocomplete component #1475
change select menus with Autocomplete component #1475
Conversation
✅ Tests will run for this PR. Once they succeed it can be merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great!
just please fix a few minor comments
<Autocomplete | ||
value={beneficiary} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add size="small" here to preserve the original for more condensed size of the dropdown
} | ||
isOptionEqualToValue={(option, value) => | ||
option.person | ||
? option.person.firstName === value?.person?.firstName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it enough to compare only the first name?
(not sure what is the expected behaviour just by reading the code)
import { useTranslation } from 'react-i18next' | ||
import { useBeneficiariesList } from 'service/beneficiary' | ||
|
||
export default function BeneficiarySelect({ name = 'beneficiaryId' }) { | ||
const { t } = useTranslation() | ||
const { data } = useBeneficiariesList() | ||
const [field, meta] = useField(name) | ||
const [field, meta, { setValue }] = useField(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the linter will complain that 'field' is unused now. to fix it just skip the field like this:
const [, meta, { setValue }] = useField(name)
#1465