mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11: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;
|
$: if (radio || batchSelection) selectable = true;
|
||||||
$: headerKeys = headers.map(({ key }) => key);
|
$: headerKeys = headers.map(({ key }) => key);
|
||||||
$: tableCellsByRowId = rows.reduce(
|
$: tableCellsByRowId = rows.reduce((rows, row) => {
|
||||||
(rows, row) => ({
|
rows[row.id] = headerKeys.map((key, index) => ({
|
||||||
...rows,
|
|
||||||
[row.id]: headerKeys.map((key, index) => ({
|
|
||||||
key,
|
key,
|
||||||
value: resolvePath(row, key),
|
value: resolvePath(row, key),
|
||||||
display: headers[index].display,
|
display: headers[index].display,
|
||||||
})),
|
}));
|
||||||
}),
|
return rows;
|
||||||
{}
|
}, {});
|
||||||
);
|
|
||||||
$: $tableRows = rows;
|
$: $tableRows = rows;
|
||||||
$: sortedRows = [...$tableRows];
|
$: sortedRows = [...$tableRows];
|
||||||
$: ascending = sortDirection === "ascending";
|
$: ascending = sortDirection === "ascending";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue