From 6e05aef0dd7c67128f2c0f0b8c24341b3095cb92 Mon Sep 17 00:00:00 2001 From: Jonas Hungershausen Date: Tue, 26 Nov 2024 10:47:27 +0100 Subject: [PATCH] chore: only reset form values if supplied --- packages/elements-react/src/components/form/form.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/elements-react/src/components/form/form.tsx b/packages/elements-react/src/components/form/form.tsx index 2103224e..5dc6f723 100644 --- a/packages/elements-react/src/components/form/form.tsx +++ b/packages/elements-react/src/components/form/form.tsx @@ -343,7 +343,12 @@ export function OryForm({ children, onAfterSubmit }: OryFormProps) { break } } - methods.setValue("password", "") + if ("password" in data) { + methods.setValue("password", "") + } + if ("code" in data) { + methods.setValue("code", "") + } onAfterSubmit?.(data.method) }