fix(taro-weapp): 在 diffObjToPath 时,如果目标数组为空,强制进行一次 setData 将其清空 #2453
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.
非 Page 类型组件 C,父级组件 P 通过 Props 传递 Array 类型的参数。在一些复杂状态的情况下,会出现赋值时,组件 C 记住了上一次 Array 的数组内容,而传递一个空 Array 进去时没有正确更新进去。此时因为信息不同步,
diffObjToPath
的toItem
和fromItem
一致,但实际渲染这个 Array 时,是存在数据的。针对这个情况,这一补丁针对
toItem
是 Array 并且是 length 为 0 的情况下,强制通知 setData 进行一次更新这个 Array 类型的数据(强制进行清空)。