mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
perf(data-table): save rows reference when reducing (#1338)
d2cdb8eb0f (r75383503)
This commit is contained in:
parent
72c24b83b2
commit
95b32937d6
1 changed files with 8 additions and 11 deletions
|
@ -199,17 +199,14 @@
|
|||
}
|
||||
$: if (radio || batchSelection) selectable = true;
|
||||
$: headerKeys = headers.map(({ key }) => key);
|
||||
$: tableCellsByRowId = rows.reduce(
|
||||
(rows, row) => ({
|
||||
...rows,
|
||||
[row.id]: headerKeys.map((key, index) => ({
|
||||
key,
|
||||
value: resolvePath(row, key),
|
||||
display: headers[index].display,
|
||||
})),
|
||||
}),
|
||||
{}
|
||||
);
|
||||
$: tableCellsByRowId = rows.reduce((rows, row) => {
|
||||
rows[row.id] = headerKeys.map((key, index) => ({
|
||||
key,
|
||||
value: resolvePath(row, key),
|
||||
display: headers[index].display,
|
||||
}));
|
||||
return rows;
|
||||
}, {});
|
||||
$: $tableRows = rows;
|
||||
$: sortedRows = [...$tableRows];
|
||||
$: ascending = sortDirection === "ascending";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue