resolveSubmission
The
resolveSubmissionfunction is part of Conform's future export. These APIs are experimental and may change in minor versions. Learn more
resolveSubmission gives you the value to validate or save for a submission. Use it for progressive enhancement in server actions.
If you already created a customized forms factory with configureForms, use forms.resolveSubmission(...) so the factory's custom intent handlers are included too.
import {
parseSubmission,
resolveSubmission,
report,
} from '@conform-to/react/future';
const schema = z.object({
// ...
});
export async function action({ request }) {
const formData = await request.formData();
const submission = parseSubmission(formData);
const { intent, value } = resolveSubmission(submission);
const result = schema.safeParse(value);
if (!intent) {
return new Response('Unknown intent', { status: 400 });
}
if (intent.type !== 'submit' || !result.success) {
return report(submission, {
value,
error: result.success ? null : result.error,
});
}
await save(result.data);
return report(submission, {
reset: true,
});
}#Parameters
submission: Submission
The submission object returned by parseSubmission.
options.handlers?: Record<string, IntentHandler>
Optional intent handlers used to extend or override the configured intent handlers for this call.
#Returns
An object with the following properties:
intent, the parsed intent, orundefinedwhen the intent type is unknown or invalidvalue, the value to validate or save
If Conform cannot resolve the intent, value falls back to the original submission payload.