Skip to content

Commit

Permalink
Update submission.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
lifeiscontent authored Aug 30, 2024
1 parent 3a09eb0 commit 8088117
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/conform-dom/submission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,21 @@ export function replySubmission<FormError>(
(context.intent?.type === 'reset' &&
(context.intent.payload.name ?? '') === '')
) {
const extraError =
'formErrors' in options || 'fieldErrors' in options
? normalize<Record<string, FormError | null>>({
'': options.formErrors ?? null,
...options.fieldErrors,
})
: null;
const error =
context.error || extraError
? {
...context.error,
...extraError,
}
: undefined;

return {
initialValue: null,
status: context.intent ? undefined : error ? 'error' : 'success'
Expand Down

0 comments on commit 8088117

Please sign in to comment.