diff --git a/public/app/features/alerting/unified/components/receivers/form/ChannelSubForm.tsx b/public/app/features/alerting/unified/components/receivers/form/ChannelSubForm.tsx index 9a767ebedb9..a239b3400db 100644 --- a/public/app/features/alerting/unified/components/receivers/form/ChannelSubForm.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/ChannelSubForm.tsx @@ -1,7 +1,7 @@ import { css } from '@emotion/css'; import { sortBy } from 'lodash'; -import { useCallback, useEffect, useMemo, useState } from 'react'; import * as React from 'react'; +import { useCallback, useEffect, useMemo, useState } from 'react'; import { Controller, FieldErrors, FieldValues, useFormContext } from 'react-hook-form'; import { GrafanaTheme2, SelectableValue } from '@grafana/data'; @@ -90,12 +90,12 @@ export function ChannelSubForm({ return () => subscription.unsubscribe(); }, [selectedType, initialValues, setValue, fieldName, watch]); - const [_secureFields, setSecureFields] = useState(secureFields ?? {}); + const [_secureFields, setSecureFields] = useState>(secureFields ?? {}); const onResetSecureField = (key: string) => { if (_secureFields[key]) { const updatedSecureFields = { ..._secureFields }; - delete updatedSecureFields[key]; + updatedSecureFields[key] = ''; setSecureFields(updatedSecureFields); setValue(`${pathPrefix}.secureFields`, updatedSecureFields); } diff --git a/public/app/types/alerting.ts b/public/app/types/alerting.ts index 3d86f9e3d5b..ac0ad119cce 100644 --- a/public/app/types/alerting.ts +++ b/public/app/types/alerting.ts @@ -111,7 +111,7 @@ export interface NotificationChannelDTO { } export type NotificationChannelSecureSettings = Record; -export type NotificationChannelSecureFields = Record; +export type NotificationChannelSecureFields = Record; export interface ChannelTypeSettings { [key: string]: any;