use array instead of first (#20964)

* use array instead of first

fixes: #19638

* pr review
This commit is contained in:
Erik Jan de Wit 2023-06-19 08:59:45 +02:00 committed by GitHub
parent 4d84725d28
commit 39e3820e9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -69,8 +69,8 @@ export const Header = ({
<DisableConfirm />
<DeleteConfirm />
<Controller
name="config.enabled[0]"
defaultValue={["true"][0]}
name="config.enabled"
defaultValue={["true"]}
control={control}
render={({ field }) =>
!id ? (
@ -94,12 +94,12 @@ export const Header = ({
{t("deleteProvider")}
</DropdownItem>,
]}
isEnabled={field.value === "true"}
isEnabled={field.value?.[0] === "true"}
onToggle={(value) => {
if (!value) {
toggleDisableDialog();
} else {
field.onChange(value.toString());
field.onChange([value.toString()]);
save();
}
}}