diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 29271b76d72..ef70d6fa713 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -17,6 +17,7 @@ "d3-scale-chromatic", // we should bump this once we move to esm modules "execa", // we should bump this once we move to esm modules "history", // we should bump this together with react-router-dom + "react-hook-form", // due to us exposing these hooks via @grafana/ui form components bumping can break plugins "react-icons", // jaeger-ui-components is being refactored to use @grafana/ui icons instead "react-router-dom", // we should bump this together with history "slate", diff --git a/package.json b/package.json index 500785904ff..47e51166d84 100644 --- a/package.json +++ b/package.json @@ -336,7 +336,7 @@ "react-draggable": "4.4.4", "react-grid-layout": "1.3.3", "react-highlight-words": "0.17.0", - "react-hook-form": "7.27.0", + "react-hook-form": "7.5.3", "react-inlinesvg": "2.3.0", "react-loadable": "5.5.0", "react-moveable": "0.30.3", diff --git a/packages/grafana-ui/package.json b/packages/grafana-ui/package.json index 377803507bf..321fadb1443 100644 --- a/packages/grafana-ui/package.json +++ b/packages/grafana-ui/package.json @@ -74,7 +74,7 @@ "react-dom": "17.0.2", "react-dropzone": "11.5.1", "react-highlight-words": "0.17.0", - "react-hook-form": "7.27.0", + "react-hook-form": "7.5.3", "react-inlinesvg": "2.3.0", "react-popper": "2.2.5", "react-popper-tooltip": "^4.3.1", diff --git a/public/app/features/alerting/unified/components/receivers/form/ReceiverForm.tsx b/public/app/features/alerting/unified/components/receivers/form/ReceiverForm.tsx index ccc021b313b..516986bb8ee 100644 --- a/public/app/features/alerting/unified/components/receivers/form/ReceiverForm.tsx +++ b/public/app/features/alerting/unified/components/receivers/form/ReceiverForm.tsx @@ -5,7 +5,7 @@ import { useCleanup } from 'app/core/hooks/useCleanup'; import { AlertManagerCortexConfig } from 'app/plugins/datasource/alertmanager/types'; import { NotifierDTO } from 'app/types'; import React, { useCallback } from 'react'; -import { useForm, FormProvider, FieldErrors, Validate, SubmitHandler } from 'react-hook-form'; +import { useForm, FormProvider, FieldErrors, Validate } from 'react-hook-form'; import { useControlledFieldArray } from '../../../hooks/useControlledFieldArray'; import { useUnifiedAlertingSelector } from '../../../hooks/useUnifiedAlertingSelector'; import { ChannelValues, CommonSettingsComponentType, ReceiverFormValues } from '../../../types/receiver-form'; @@ -94,7 +94,7 @@ export function ReceiverForm({ Because there is no default policy configured yet, this contact point will automatically be set as default. )} -
>, onInvalid)}> +

{readOnly ? 'Contact point' : initialValues ? 'Update contact point' : 'Create contact point'}

@@ -121,13 +121,13 @@ export function ReceiverForm({ defaultValues={field} key={field.__id} onDuplicate={() => { - const currentValues = getValues().items[index] as R; + const currentValues: R = getValues().items[index]; append({ ...currentValues, __id: String(Math.random()) }); }} onTest={ onTestChannel ? () => { - const currentValues = getValues().items[index] as R; + const currentValues: R = getValues().items[index]; onTestChannel(currentValues); } : undefined diff --git a/public/app/features/alerting/unified/components/rule-editor/AlertTypeStep.tsx b/public/app/features/alerting/unified/components/rule-editor/AlertTypeStep.tsx index 54daf57fa7c..4a96553d037 100644 --- a/public/app/features/alerting/unified/components/rule-editor/AlertTypeStep.tsx +++ b/public/app/features/alerting/unified/components/rule-editor/AlertTypeStep.tsx @@ -10,7 +10,6 @@ import { GroupAndNamespaceFields } from './GroupAndNamespaceFields'; import { contextSrv } from 'app/core/services/context_srv'; import { CloudRulesSourcePicker } from './CloudRulesSourcePicker'; import { checkForPathSeparator } from './util'; -import { get } from 'lodash'; interface Props { editingExistingRule: boolean; @@ -149,9 +148,8 @@ export const AlertTypeStep: FC = ({ editingExistingRule }) => {