alibaba / alibaba/formily

[Bug Report] 字段使用x-visible切换时,重新输入会丢失字段问题

Open
#4,076 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
12.6k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

  • I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link

Edit on CodeSandbox

Steps to reproduce

在“Topic”字段中随意输入值,然后选择其他“类型”字段,再次修改“Topci”字段,formValues中不会有topic字段

What is expected?

在选择不同的类型后,始终保留topic字段

What is actually happening?

topic字段会被删除,再输入时不会存在与values中

Package

@formily/react@2.3.1


这个场景我理解是一个很普遍的场景,public、private字段会受type字段改变visible值,这2个字段下都有某个相同的字段时,该字段会在切换后就不出现在values中了。

我尝试使用 x-hidden,但无法达到我的要求,因为我希望给到后端的字段是非冗余的。

期待您的回复!感谢!

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 using @formily/react@2.3.1 and follow the Topic field while changing the type field. Compare formValues before and after changing visibility, then confirm the fix by checking that re-entering Topic preserves it in formValues while unrelated hidden fields remain excluded.

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.