Skip to content

Row selection causes entire table to re-render #26206

@ling1726

Description

@ling1726
  1. Use React Profiler. Click the settings gear button and under the "General" tab check "Highlight update when components render"
  2. In the multi or single select stories change the selection
  3. Observe that the entire table re-renders

This isn't a big deal for an example table but for any moderately sized table this is likely to be an issue. Memoizing all the things definitely makes the example harder to follow and while I haven't dug in very far there is probably a fair bit of extra work to optimize React renders (for example, the onClick and onKeyDown functions trigger re-renders as does the object passed into Avatar's badge slot).

Worth considering having an "optimized" example or if it's possible for useTableFeatures to be more optimal be default. Interestingly, the virtualized example does no re-render everything when selections change so perhaps there is a simple way to improve the defaults from useTableFeatures.

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