Devtools shows duplicate form entries in React Strict Mode after 0.2.11 upgrade

未關閉
#1,979 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
38/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
nextjs, react, typescript
領域
devtools, frontend

研究方向

在啟用 reactStrictMode 的 Next.js 應用程式中使用 @tanstack/[email protected] 重現該問題,並與 0.2.9 進行比較。檢查圍繞 #1978 以及 @tanstack/devtools-utils 升級引入的註冊和 cleanup 行為;當 Strict Mode 顯示一個表單項目而不是重複項目時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

v1 v2: needs investigation

Describe the bug

After upgrading @tanstack/react-form-devtools from 0.2.9 to 0.2.11, the devtools panel shows duplicate form entries (two identical "TANSTACK TanStack Form" headers) when React Strict Mode is enabled.

Your minimal, reproducible example

Any Next.js app with reactStrictMode: true in next.config.js and a form using TanStack Form.

Steps to reproduce

  1. Create a Next.js app with reactStrictMode: true
  2. Install @tanstack/[email protected] - observe single form entry in devtools
  3. Upgrade to @tanstack/[email protected] - observe duplicate form entries

Expected behavior

Single form entry in devtools, same as in 0.2.9.

How often does this bug happen?

Every time (100% reproducible)

Screenshots

Image

Two identical "TANSTACK TanStack Form" headers appear in the devtools panel.

Platform

  • Next.js 15.x with React 19
  • reactStrictMode: true
  • macOS / Chrome

TanStack Form version

Analysis

The issue appears to be related to the strict mode fix in #1978. React Strict Mode intentionally mounts components twice (mount → unmount → mount). The fix in 0.2.11 prevents the error but seems to cause forms to be registered twice instead of being properly cleaned up on the first unmount.

The significant version jump in @tanstack/devtools-utils (0.0.9 → 0.2.3) is likely where the regression was introduced.

主要語言
TypeScript
星號
6.8k
分支
717
平均合併
5 天 22 小時
30 天內合併 PR
14

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

TanStack/form 的其他 Issue

查看 TanStack/form 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。