Skip to content
Source
Sign inSign up
TanStack/form

[react-form-start] Cannot restore form state after post-validation submission errors #2272

Send to my agent
Openjuanmarin-co(GitHub profile, opens in a new tab) opened this issue 0 comments

Observed behavior

With a native TanStack Start form:

<form action={submitForm.url} method="post">

createServerValidate correctly preserves values and errors when server validation fails.

However, if validation succeeds and the subsequent mutation returns a domain error, there is no public API to persist an arbitrary ServerFormState across the redirect:

const values = await serverValidate(formData);
const result = await createResource(values);

if (!result.success) {
  // Cannot restore `values` with field/form errors after redirecting.
}

Returning the form state from the server function navigates the browser to the raw server-function response instead of restoring the original form.

Expected behavior

@tanstack/react-form-start should provide a public API to persist an arbitrary ServerFormState and redirect back to the form, using the same restoration mechanism as createServerValidate.

This would allow post-validation mutation errors to preserve submitted values and populate form-level or field-level errors after the POST/Redirect/GET cycle.

Version: @tanstack/react-form-start@1.33.3

  1. LeCarbonator(GitHub profile, opens in a new tab) added labelsv2: needs investigation

Sign in to join this conversation.