perf(data-table): save rows reference when reducing (#1338)

d2cdb8eb0f (r75383503)
This commit is contained in:
metonym 2022-06-05 14:24:37 -07:00 committed by GitHub
commit 95b32937d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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";