Skip to content
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

fix($table): synchronize the colspan state of the table component #2237

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

zindler323
Copy link

@zindler323 zindler323 commented May 24, 2023

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

💡 需求背景和解决方案
table的合并单元格未能及时更新view:
image
image
image

commit1:
        在使用Table组件的合并单元格功能时,发现在填充数据后的第一次update中没有合并单元格,需要强制再update一次才能正常合并。查看Table源码发现:控制单元格合并的状态skipSpansMap在表格数据发生变化时,仅对skipSpansMap进行了异步的原地修改,因此不能及时更新视图。
        解决方案:在状态需要改变时,构建新的不可变数据,并使用useState返回的state setter来及时更新。
commit2:
        考虑到react系统内的状态关联不必使用effect(You might not need an effect),加上rowspanAndColspan基本上是每次render时构建的匿名函数(缓存skipSpansMap意义不大),因此直接在useRowspanAndColspan hook最顶层直接同步计算skipSpansMap(200行*5列表格数据情况下,平均计算时长<0.5ms)。

📝 更新日志

  • fix(Table): 修复Table组件的【单元格合并配置】不同步。

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@github-actions
Copy link
Contributor

github-actions bot commented May 25, 2023

完成

@chaishi
Copy link
Collaborator

chaishi commented Jul 25, 2023

我确认下这里的变更

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants