Skip to content

using a component as title in a column definition can cause massive performance issues #111

Closed
@paintier

Description

@paintier

Hi all,

the componentDidUpdate() method in material-table.js calls equal to figure out if the columns definition has changed.

This can lead a big performance issues if the title attribute is a component, e.g.

const columns = [
  {
    title: <FancyHeader />,
    field: 'some_field'
  }
...
]

see also this bugreport which describes why comparing two components using "equal" is a bad idea.

In edge cases this can lead to "maximum stack size exceeded" error messages.

Unfortunately there seems to exist no easy way to figure out if two react-components are rendered identically, so IMHO it would be best to consider the column definitions to have changed if the title attribute is a component and skip the equals test.

Metadata

Metadata

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions