formily icon indicating copy to clipboard operation
formily copied to clipboard

[Bug Report] useFormEffect 中使用 onFieldChange 在 React18 开发环境的严格默认下,会执行两次

Open hchlq opened this issue 1 year ago • 2 comments

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

Reproduction link

Edit on CodeSandbox

Steps to reproduce

点开链接,打开控制台,更改值,发现执行两次

What is expected?

只执行一次

What is actually happening?

执行了两次

Package

@formily/[email protected]


原因就是 onFieldChange 被执行了两次,虽然在 useFormEffect 销毁时移除了 effect,但是没有将 onFieldChange reaction 的依赖的清除掉

hchlq avatar Jul 05 '23 09:07 hchlq

这个我来处理。

hchlq avatar Jul 05 '23 09:07 hchlq

暂时可以使用 onFieldValueChagne 绕过这个问题

coolbob1998 avatar Jan 08 '24 03:01 coolbob1998