From 99d2fa97901f57ec7d902d6e6578581fdece6237 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 17 Jun 2025 17:24:12 +0200 Subject: [PATCH] Reset people form on submit Signed-off-by: Bryan Frimin --- .../organizations/people/dialogs/CreatePeopleDialog.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/console/src/pages/organizations/people/dialogs/CreatePeopleDialog.tsx b/apps/console/src/pages/organizations/people/dialogs/CreatePeopleDialog.tsx index e6453462b..fc7e0ab30 100644 --- a/apps/console/src/pages/organizations/people/dialogs/CreatePeopleDialog.tsx +++ b/apps/console/src/pages/organizations/people/dialogs/CreatePeopleDialog.tsx @@ -30,7 +30,7 @@ const schema = z.object({ additionalEmailAddresses: z.preprocess( // Empty additional emails are skipped (v) => (v as string[]).filter((v) => !!v), - z.array(z.string().email()) + z.array(z.string().email()), ), kind: z.enum(peopleRoles), }); @@ -57,7 +57,7 @@ export const createPeopleMutation = graphql` export function CreatePeopleDialog({ children, connectionId }: Props) { const { __ } = useTranslate(); const organizationId = useOrganizationId(); - const { control, handleSubmit, register } = useFormWithSchema(schema, { + const { control, handleSubmit, register, reset } = useFormWithSchema(schema, { defaultValues: { additionalEmailAddresses: [], }, @@ -79,6 +79,7 @@ export function CreatePeopleDialog({ children, connectionId }: Props) { connections: [connectionId], }, onSuccess: () => { + reset(); ref.current?.close(); }, });