Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] array 类型下子字段也为 array类型时,某些场景会导致添加item 异常 #4024

Open
1 task done
faner11 opened this issue Nov 10, 2023 · 1 comment

Comments

@faner11
Copy link
Contributor

faner11 commented Nov 10, 2023

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

Reproduction link

Edit on CodeSandbox

Steps to reproduce

image

  1. 点击3次 "第二层添加" 按钮
  2. 点击第一层的删除
  3. 点击 “第一层添加”

What is expected?

点击第一层添加时,基于默认值来,而不是第二层会有多条

What is actually happening?

第二层出现3条

Package

@formily/[email protected]


其他

  checked: {
    type: "boolean",
    "x-decorator": "FormItem",
    "x-component": "Checkbox",
    default: true,
  },

当我没有给 checked 设置默认值的时候,表现看上去正常,但是也有问题,当修改了某个值,依然会出现此问题

@xiaosi-ss
Copy link
Contributor

主要是因为 你setchecked产生了initialValues

这个问题很无解 我一般都手动操作initialValues

charlzyx added a commit to charlzyx/formily that referenced this issue Dec 28, 2023
charlzyx pushed a commit to charlzyx/formily that referenced this issue Dec 29, 2023
fix: nested array initial-value reset on destory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants