fix cant save form

This commit is contained in:
miloschwartz
2026-04-21 16:19:32 -07:00
parent 8dbe0a4bfe
commit b5dd20e499
4 changed files with 15 additions and 12 deletions

View File

@@ -1156,6 +1156,7 @@ export function AlertRuleSourceFields({
<FormField
control={control}
name="allSites"
shouldUnregister={false}
render={({ field }) => (
<FormItem>
<StrategySelect
@@ -1198,6 +1199,7 @@ export function AlertRuleSourceFields({
<FormField
control={control}
name="allResources"
shouldUnregister={false}
render={({ field }) => (
<FormItem>
<StrategySelect
@@ -1240,6 +1242,7 @@ export function AlertRuleSourceFields({
<FormField
control={control}
name="allHealthChecks"
shouldUnregister={false}
render={({ field }) => (
<FormItem>
<StrategySelect

View File

@@ -34,7 +34,7 @@ import { ChevronLeft, Cog, Flag, Zap } from "lucide-react";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useMemo, useState, type ReactNode } from "react";
import { useFieldArray, useForm } from "react-hook-form";
import { useFieldArray, useForm, type Resolver } from "react-hook-form";
import { useTranslations } from "next-intl";
import { PaidFeaturesAlert } from "@app/components/PaidFeaturesAlert";
import { SwitchInput } from "@app/components/SwitchInput";
@@ -116,7 +116,7 @@ export default function AlertRuleGraphEditor({
const [isSaving, setIsSaving] = useState(false);
const schema = useMemo(() => buildFormSchema(t), [t]);
const form = useForm<AlertRuleFormValues>({
resolver: zodResolver(schema),
resolver: zodResolver(schema) as Resolver<AlertRuleFormValues>,
defaultValues: initialValues ?? defaultFormValues()
});