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