Skip to content

Commit

Permalink
Initialize default role on via form controls
Browse files Browse the repository at this point in the history
  • Loading branch information
LauraBeatris committed Oct 3, 2024
1 parent 5aeff83 commit 7119b0f
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ export const InviteMembersForm = (props: InviteMembersFormProps) => {
label: localizationKeys('formFieldLabel__emailAddresses'),
});

const roleField = useFormControl('role', '', {
const defaultRole = useDefaultRole();
const roleField = useFormControl('role', defaultRole ?? '', {
label: localizationKeys('formFieldLabel__role'),
});

Expand Down Expand Up @@ -188,8 +189,6 @@ const AsyncRoleSelect = (field: ReturnType<typeof useFormControl<'role'>>) => {

const { t } = useLocalizations();

const defaultRole = useDefaultRole();

return (
<Form.ControlRow elementId={field.id}>
<Flex
Expand All @@ -198,7 +197,6 @@ const AsyncRoleSelect = (field: ReturnType<typeof useFormControl<'role'>>) => {
>
<RoleSelect
{...field.props}
value={field.props.value || (defaultRole ?? '')}
roles={options}
isDisabled={isLoading}
onChange={value => field.setValue(value)}
Expand Down

0 comments on commit 7119b0f

Please sign in to comment.