Replies: 2 comments 6 replies
-
Thank you for your interest in Conform. The behavior of |
Beta Was this translation helpful? Give feedback.
-
Hi @chimame , I understand that what I ask is not the expected behavior of please use Don't hesitate if you have any questions. And also if you see another way to achieve the same result. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Re-Hi,
When we parse formData with
parseWithZod
we get aSubmission
discriminated Union type depending on the statussuccess
orerror
.when zod parse the input with
schema.safeParse
he returns data coerced and we can use that in thevalue
property.Actually when we validate a submission the value is not available even if validation is successfull.
Here you can find some test I write wich highlights my issue
the logic is in this line :
conform/packages/conform-dom/submission.ts
Line 225 in 077215b
I wanted to know if it can be possible to make accessible the value if this value is available by a successfull parse even if it is a validation ?
// packages/conform-dom/submission.ts export function createSubmission<FormValue, FormError>( context: SubmissionContext<FormValue, FormError>, ): Submission<FormValue, FormError> { if (context.intent || !context.value || context.error) { return { status: !context.intent ? 'error' : undefined, payload: context.payload, error: typeof context.error !== 'undefined' ? context.error : {}, + value: context.value, reply(options) { return replySubmission(context, options); }, }; } return { status: 'success', payload: context.payload, value: context.value, reply(options) { return replySubmission(context, options); }, }; }
Use case
I have a form and I have a preview component who need to be updated in real time with validated data.
Thank you very much :-)
Beta Was this translation helpful? Give feedback.
All reactions