Skip to content

很多表格组件在unmount时出现性能问题 #33510

@MatriXiao88

Description

@MatriXiao88
  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  1. 需要很多的表格组件
  2. 点击案例中的切换按钮
  3. 会发现页面出现卡顿,然后才能看到切换后的文案

What is expected?

  1. 点击切换不卡顿

What is actually happening?

  1. 点击切换卡顿
Environment Info
antd 4.18.2
React 18.0.0
System windows 10
Browser chrome浏览器

  1. 根据性能工具的简单调查,会发现table组件在卸载的时候,会触发这里代码去获取dom元素的scrollLeft,导致重排
  2. 想了解一下为什么要在unmount的时候需要重新获取scrollLeft,看注释说明的话,获取滚动条位置并不需要在卸载时去获取,那到底是为啥呢?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions