最后两个卡片,操作之后,其他几个卡片的图表会重载动画。
不排除其他页面有类似问题,看下是否 PureComponent 没有起到应起的作用。
这个应该是我的锅,我之前以为 componentWillReceiveProps 是需要接收 new props 才触发,结果其实不一定:https://facebook.github.io/react/docs/react-component.html#componentwillreceiveprops
然后 PureCompnonent 其实是在 shouldComponentUpdate 里面浅对比,所以因为 componentWillReceiveProps 没有做各项的判断,所以每次 更新都去 renderCharts 了,我统一改一下 🚗
fixed: https://github.com/ant-design/test2/pull/8/commits/9fc16092931ca11ec8987992d29d21bb9b5ba688#diff-b9e446d51c0cf64f75980ecea5c8ff5dR12
可以关联到 commit message 里。
推荐用下面的命令提交。
git commit -a
格式推荐如下:
xxx xxxx xxx xxx xxx
close #issue_id
see also: #issue_id
* related link: http://xxx.com
Most helpful comment
这个应该是我的锅,我之前以为
componentWillReceiveProps是需要接收new props才触发,结果其实不一定:https://facebook.github.io/react/docs/react-component.html#componentwillreceiveprops然后
PureCompnonent其实是在shouldComponentUpdate里面浅对比,所以因为componentWillReceiveProps没有做各项的判断,所以每次 更新都去renderCharts了,我统一改一下 🚗