perf: Optimize performance of Results and Samples tables on Explore (#12257)

This commit is contained in:
Kamil Gabryjelski
2021-01-08 21:07:51 +01:00
committed by GitHub
parent 76b06b215f
commit fd15dff60e
6 changed files with 25 additions and 51 deletions

View File

@@ -52,9 +52,6 @@ export const Table = styled.table`
background: ${({ theme }) => theme.colors.grayscale.light5};
position: sticky;
top: 0;
white-space: nowrap;
&:first-of-type {
padding-left: ${({ theme }) => theme.gridUnit * 4}px;
}
@@ -205,17 +202,17 @@ export const Table = styled.table`
Table.displayName = 'table';
export default function TableCollection({
getTableProps,
getTableBodyProps,
prepareRow,
headerGroups,
columns,
rows,
loading,
highlightRowId,
}: TableCollectionProps) {
return (
export default React.memo(
({
getTableProps,
getTableBodyProps,
prepareRow,
headerGroups,
columns,
rows,
loading,
highlightRowId,
}: TableCollectionProps) => (
<Table
{...getTableProps()}
className="table table-hover"
@@ -314,5 +311,5 @@ export default function TableCollection({
})}
</tbody>
</Table>
);
}
),
);