fix(field): remove useDeepCompareMemo which causing renderFormItem not updated #7887
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix issue #7801.
Root cause
以7801中的例子来解释,form item按antd联动的方式定义
那么这个FormItem会在
state
值更改的时候重新渲染,但是重新渲染时props的内容用deep compare比较时并未改变,所以diff中的useDeepCompareMemo
会导致本来可以渲染出的更新丢失掉。2.6.20以及之前版本是正常的,是因为之前用的是
useMemo
,useMemo
生效是因为rest
在每次渲染的时候都会生成一个新的,应该是没有意义的,这里我直接去掉了。