Skip to content

Commit

Permalink
Fix update round
Browse files Browse the repository at this point in the history
  • Loading branch information
carlbarrdahl committed Apr 4, 2024
1 parent 75e238f commit 7cf3ad8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/components/ui/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ export function Form<S extends z.Schema>({
});

usePersistForm(form, persist);

// Pass the form methods to a FormProvider. This lets us access the form from components with useFormContext
return (
<FormProvider {...form}>
Expand Down
5 changes: 4 additions & 1 deletion src/features/rounds/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ export const RoundSchema = z
tokenAddress: EthAddressSchema.nullable(),
poolId: z.number().nullable(),
calculationType: CalculationTypeSchema,
calculationConfig: z.record(z.string().or(z.number())).optional(),
calculationConfig: z
.record(z.string().or(z.number()))
.nullish()
.default({}),
})
.merge(RoundDates)
.merge(RoundVotes);
Expand Down
4 changes: 3 additions & 1 deletion src/pages/[domain]/admin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ function RoundForm({ round }: { round: RoundSchema }) {
const utils = api.useUtils();
const router = useRouter();
const update = useUpdateRound();

console.group(round);
return (
<Form
defaultValues={{ ...round }}
Expand All @@ -38,7 +40,7 @@ function RoundForm({ round }: { round: RoundSchema }) {
},
});
}}
schema={RoundSchema}
schema={RoundSchema.partial()}
>
<FormSection
title="Round details"
Expand Down

0 comments on commit 7cf3ad8

Please sign in to comment.