react-component / react-component/field-form

setFieldsValue 后getFieldsValue会获取到非 form结构的数据(After using setFieldsValue, calling getFieldsValue will retrieve the values, including those that are not part of the form structure.)

Open
#601 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1k
Forks
286
Avg merge
4d 16h
Merged PRs (30d)
1

Description

当setFieldsValue设置回显值的时候,设置了数组结构中不存在的元素,在稍后的提交中这个多的元素还会存在,非数组结构就没有这个问题。
When using setFieldsValue to set the initial values for form fields, if you include an element that does not exist in the original data structure of an array, this extra element will still persist during subsequent form submissions. However, with non-array data structures, this issue does not occur.

demo:https://codesandbox.io/s/frosty-star-7h3x97?file=/App.tsx

Contributor guide

No contributing guide indexed for this repository

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 demo in App.tsx and reproduce the behavior by setting a value containing an element absent from the original array structure. Trace how setFieldsValue and getFieldsValue handle array values, then verify that subsequent submitted values exclude the extra element while non-array behavior remains unchanged.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.