alibaba/formily

[Bug Report] 当表单中有两层数组嵌套时,void节点有可能出现在 formValues 中

Closed this issue · 2 comments

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

Reproduction link

Edit on CodeSandbox

Steps to reproduce

报歉,我打不开Codesanbox,所以是在另一个工具上复线的。

  1. 访问如下地址 https://stackblitz.com/edit/formily-react-demo-pba7mx?file=package.json,src%2Fdemo%2FSchemaDemo.tsx,src%2Fdemo%2FArrayItems.tsx,src%2Fdemo%2Fstyle.css,src%2Fdemo%2FDemo.tsx
  2. 点击“添加”按钮,然后在输入框中输入内容。
  3. 删除刚添加的条目
  4. 点击“添加”按钮,然后重新在输入框中输入内容。此时在下面的 form.values 中可以观察看 void 节点对应的 space 出现在了数据中。

What is expected?

void 节点在 formValues 中被过滤

What is actually happening?

void 节点出现在了 formValues 中

Package

@formily/core@2.2.27


如果使用 antd-v5 的 ArrayItems 组件,则不会出现这个问题。使用自己开发的 ArrayItems 则会出现这个问题,想知道是什么原因。

已解决,问题是组件使用了 scheduler 导致的时序问题,删除 scheduler 相关配置就可以了