Skip to content

Commit

Permalink
docs: add notice for onFormValuesChange (#2146)
Browse files Browse the repository at this point in the history
  • Loading branch information
MisicDemone authored Sep 13, 2021
1 parent 48ed7b0 commit c8176e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/core/docs/api/entry/FormEffectHooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ export default () => {

Side effect hooks for monitoring form value changes

<Alert>
It should be noted that this hook is triggered synchronously. For some behaviors that trigger `set` operation of `Proxy` multiple times, the results may not be as expected. For example, when deleting elements from array by `splice`, the array length will be the same as before deletion. (<a href="https://github.com/alibaba/formily/issues/2128">#2128</a>)
</Alert>

#### Signature

```ts
Expand Down
4 changes: 4 additions & 0 deletions packages/core/docs/api/entry/FormEffectHooks.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ export default () => {

用于监听表单值变化的副作用钩子

<Alert>
需要注意此钩子是同步触发的,对于某些会多次触发 Proxy set 操作的行为,得到的结果可能会与预期不符。例如: 数组 splice 删除元素时,数组长度会和删除之前相同,只是被删除元素被置为了 undefined。此时需要使用方按需添加 debounce 或 setTimeout。(<a href="https://github.com/alibaba/formily/issues/2128">#2128</a>)
</Alert>

#### 签名

```ts
Expand Down

0 comments on commit c8176e5

Please sign in to comment.