Ant-design-pro: 分析页卡片异常联动

Created on 6 Sep 2017  ·  4Comments  ·  Source: ant-design/ant-design-pro

最后两个卡片,操作之后,其他几个卡片的图表会重载动画。

不排除其他页面有类似问题,看下是否 PureComponent 没有起到应起的作用。

🏆 Feature Request

Most helpful comment

这个应该是我的锅,我之前以为 componentWillReceiveProps 是需要接收 new props 才触发,结果其实不一定:https://facebook.github.io/react/docs/react-component.html#componentwillreceiveprops

然后 PureCompnonent 其实是在 shouldComponentUpdate 里面浅对比,所以因为 componentWillReceiveProps 没有做各项的判断,所以每次 更新都去 renderCharts 了,我统一改一下 🚗

All 4 comments

这个应该是我的锅,我之前以为 componentWillReceiveProps 是需要接收 new props 才触发,结果其实不一定:https://facebook.github.io/react/docs/react-component.html#componentwillreceiveprops

然后 PureCompnonent 其实是在 shouldComponentUpdate 里面浅对比,所以因为 componentWillReceiveProps 没有做各项的判断,所以每次 更新都去 renderCharts 了,我统一改一下 🚗

可以关联到 commit message 里。

推荐用下面的命令提交。

git commit -a

格式推荐如下:

xxx xxxx xxx xxx xxx

close #issue_id
see also: #issue_id

* related link: http://xxx.com
Was this page helpful?
0 / 5 - 0 ratings

Related issues

yjz1004 picture yjz1004  ·  3Comments

zhuanglong picture zhuanglong  ·  3Comments

2uncle-code picture 2uncle-code  ·  3Comments

wuyongdec picture wuyongdec  ·  3Comments

renyi818 picture renyi818  ·  3Comments