-
Notifications
You must be signed in to change notification settings - Fork 580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract hover state by creating a global state #95
Conversation
是不是只要在 shouldComponentUpdate 里判断,只有 |
应该是可以的,不过刚刚发现,现在的 shouldComponentUpdate 也有问题,因为固定列的 columns 每次都会重新生成 https://github.com/react-component/table/blob/master/src/Table.jsx#L386 所以固定列的 我先看看能不能把这个 shouldComponentUpdate 优化下。 |
或者用 context 解决。 |
columns 目测有两个地方可以优化: |
const listeners = []; | ||
|
||
function setState(partial) { | ||
state = assign({}, state, partial); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直接用 { ...xx }
还有 groupColumns 也会生成新的 columns。 |
我想写一个专门来管理各种 columns 计算的类,然后把计算结果都缓存起来。 |
context 怎么搞? |
我重新发个 PR。 |
@afc163 这个 PR 也调整过了。 |
写了个类似 redux 的 store,把 hover 状态提了出来,这样 hover 状态变化的时候就不需要渲染整个 Table 了。
ant-design/ant-design#3096