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

Đang mở
#1,979 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
38/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
nextjs, react, typescript
Lĩnh vực
devtools, frontend

Hướng nghiên cứu

Tái hiện vấn đề trong một ứng dụng Next.js với reactStrictMode được bật bằng cách sử dụng @tanstack/[email protected] và so sánh với 0.2.9. Kiểm tra hành vi đăng ký và cleanup được giới thiệu xung quanh #1978 và bản nâng cấp @tanstack/devtools-utils; hoàn thành khi Strict Mode hiển thị một mục form thay vì các mục trùng lặp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
6.8k
Fork
717
Merge trung bình
5 ngày 22 giờ
Pull request đã merge (30 ngày)
14

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TanStack/form

Tất cả issue của TanStack/form

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.