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

オープン
#2,272 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
react, typescript
領域
frontend

調査の方向性

@tanstack/react-form-start における createServerValidate と ServerFormState の復元フローを追跡することから始め、ネイティブ POST フォームとリダイレクトサイクルに焦点を当てます。検証後の mutation エラーから生じた任意の状態を、生の server-function response に移動せずに永続化および復元する方法を定義します。公開 API を通じて POST/Redirect/GET フローの間、フォームの値とフィールドレベルまたはフォームレベルのエラーが維持されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

v1 v2: needs investigation
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/[email protected]

主要言語
TypeScript
スター
6.8k
フォーク
705
平均マージ
1日 12時間
マージ済み PR(30日)
14

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TanStack/form のほかの issue

TanStack/form の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。