mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 03:01:21 -04:00
Improve table formatting performance (#133884)
Co-authored-by: Joe Reuter <johannes.reuter@elastic.co>
This commit is contained in:
parent
bd485d5d23
commit
d02d12b859
1 changed files with 19 additions and 20 deletions
|
@ -150,28 +150,27 @@ export const getFormattedTable = (
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
|
|
||||||
const formattedTableInfo = table.rows.reduce<{
|
const formattedTableInfo: {
|
||||||
rows: Datatable['rows'];
|
rows: Datatable['rows'];
|
||||||
formattedColumns: Record<string, true>;
|
formattedColumns: Record<string, true>;
|
||||||
}>(
|
} = {
|
||||||
({ rows: formattedRows, formattedColumns }, row) => {
|
rows: [],
|
||||||
const formattedRowInfo = getFormattedRow(
|
formattedColumns: {},
|
||||||
row,
|
};
|
||||||
table.columns,
|
for (const row of table.rows) {
|
||||||
columnsFormatters,
|
const formattedRowInfo = getFormattedRow(
|
||||||
xAccessor ? getAccessorByDimension(xAccessor, table.columns) : undefined,
|
row,
|
||||||
xScaleType
|
table.columns,
|
||||||
);
|
columnsFormatters,
|
||||||
return {
|
xAccessor ? getAccessorByDimension(xAccessor, table.columns) : undefined,
|
||||||
rows: [...formattedRows, formattedRowInfo.row],
|
xScaleType
|
||||||
formattedColumns: { ...formattedColumns, ...formattedRowInfo.formattedColumns },
|
);
|
||||||
};
|
formattedTableInfo.rows.push(formattedRowInfo.row);
|
||||||
},
|
formattedTableInfo.formattedColumns = {
|
||||||
{
|
...formattedTableInfo.formattedColumns,
|
||||||
rows: [],
|
...formattedRowInfo.formattedColumns,
|
||||||
formattedColumns: {},
|
};
|
||||||
}
|
}
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
table: { ...table, rows: formattedTableInfo.rows },
|
table: { ...table, rows: formattedTableInfo.rows },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue