mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 11:05:39 -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,11 +150,14 @@ export const getFormattedTable = (
|
|||
{}
|
||||
);
|
||||
|
||||
const formattedTableInfo = table.rows.reduce<{
|
||||
const formattedTableInfo: {
|
||||
rows: Datatable['rows'];
|
||||
formattedColumns: Record<string, true>;
|
||||
}>(
|
||||
({ rows: formattedRows, formattedColumns }, row) => {
|
||||
} = {
|
||||
rows: [],
|
||||
formattedColumns: {},
|
||||
};
|
||||
for (const row of table.rows) {
|
||||
const formattedRowInfo = getFormattedRow(
|
||||
row,
|
||||
table.columns,
|
||||
|
@ -162,16 +165,12 @@ export const getFormattedTable = (
|
|||
xAccessor ? getAccessorByDimension(xAccessor, table.columns) : undefined,
|
||||
xScaleType
|
||||
);
|
||||
return {
|
||||
rows: [...formattedRows, formattedRowInfo.row],
|
||||
formattedColumns: { ...formattedColumns, ...formattedRowInfo.formattedColumns },
|
||||
formattedTableInfo.rows.push(formattedRowInfo.row);
|
||||
formattedTableInfo.formattedColumns = {
|
||||
...formattedTableInfo.formattedColumns,
|
||||
...formattedRowInfo.formattedColumns,
|
||||
};
|
||||
},
|
||||
{
|
||||
rows: [],
|
||||
formattedColumns: {},
|
||||
}
|
||||
);
|
||||
|
||||
return {
|
||||
table: { ...table, rows: formattedTableInfo.rows },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue