Tencent / Tencent/tdesign-react

[FormItem] FormItem组件会用自己的缺省值覆盖用户的props,导致初始化时丢失用户原来的状态

Open
#2,804 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

💭 discussion usage
Dominant language
TypeScript
Stars
965
Forks
373
Avg merge
3d 6h
Merged PRs (30d)
17

Description

tdesign-react 版本

1.5.3

重现链接

https://codesandbox.io/p/sandbox/formitem-khwfg8

重现步骤
image image

** 源码捞出来在本地测试的结果:**
image
image
image
image

最简单的案例
image
image

期望结果

不要影响用户的原始表单状态

实际结果

实际结果是用户状态被覆盖了

框架版本

No response

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

解决办法已经贴图里了,亲测有效~

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodeSandbox reproduction and the FormItem component entry point, then compare the user's initial props with the component's default values during initialization. Done means the user's original form state remains unchanged while the FormItem still initializes normally.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.