Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [3.1.0-rc20] - 2018-11-01
### Fixed
- Fix performance degradation on load [#200](https://github.com/plotly/dash-table/pull/200) [#198](https://github.com/plotly/dash-table/issues/198)


## [3.1.0-rc19] - 2018-11-01
### Changed
- Change default styles [#193](https://github.com/plotly/dash-table/pull/193) [#150](https://github.com/plotly/dash-table/issues/150)
Expand Down
2 changes: 1 addition & 1 deletion dash_table/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_table/demo.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_table/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dash-table",
"version": "3.1.0-rc19",
"version": "3.1.0-rc20",
"description": "Dash table",
"main": "build/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dash-table",
"version": "3.1.0-rc19",
"version": "3.1.0-rc20",
"description": "Dash table",
"main": "build/index.js",
"scripts": {
Expand Down
9 changes: 6 additions & 3 deletions src/dash-table/components/ControlledTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import derivedTable from 'dash-table/derived/table';
import derivedTableFragments from 'dash-table/derived/table/fragments';
import isEditable from 'dash-table/derived/cell/isEditable';
import { derivedTableStyle } from 'dash-table/derived/style';
import { IStyle } from 'dash-table/derived/style/props';

const sortNumerical = R.sort<number>((a, b) => a - b);

Expand All @@ -37,6 +38,10 @@ export default class ControlledTable extends PureComponent<ControlledTableProps,
private readonly tableFn: () => JSX.Element[][];
private readonly tableStyle = derivedTableStyle();

private calculateTableStyle = memoizeOne((style: Partial<IStyle>) => R.mergeAll(
this.tableStyle(DEFAULT_STYLE, style)
));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style_table rarely changes, merging it with DEFAULT_STYLE creates a new object each time, triggering lots of re-renders and layout reevaluations. Memoizing the value prevents those problematic re-renders from occurring and brings performance back to what it used to be.


constructor(props: ControlledTableProps) {
super(props);

Expand Down Expand Up @@ -624,9 +629,7 @@ export default class ControlledTable extends PureComponent<ControlledTableProps,
const rawTable = this.tableFn();
const grid = derivedTableFragments(n_fixed_columns, n_fixed_rows, rawTable);

const tableStyle = R.mergeAll(
this.tableStyle(DEFAULT_STYLE, style_table)
);
const tableStyle = this.calculateTableStyle(style_table);

return (<div
id={id}
Expand Down