react-component / react-component/field-form

antd-form v3与v4表现不一致

Open
#93 2 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

问题1:antd v3使用rc-form时,当因为逻辑分支导致被getFieldDecorator包裹的部分字段未被渲染时,原本保存在这些字段上的值会被清空,再次渲染时会使用initialValue上的值进行初始化;但v4使用rc-field-form时,未被渲染字段的值会持久保存,再次渲染时直接使用之前保存的值。这一行为不一致是刻意的还是bug?
v3版demo:https://codesandbox.io/s/kind-pare-2l760
v4版demo:https://codesandbox.io/s/dark-bush-gzv86
可以看到baz字段在两者间表现的不一致。
问题2:onFieldsChange回调api会在一次交互时触发2次,且第二次的changedFields参数为空数组,感觉是个bug?

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

Reproduce the two reported behaviors using the linked v3 and v4 CodeSandbox demos, focusing on the baz field and the onFieldsChange callback. Compare how rc-form and rc-field-form handle unrendered field values and empty changedFields results. A maintainer decision is needed on the intended behavior before implementation; done means the behavior is agreed and covered by suitable regression checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react, typescript
Domain
frontend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.