Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to virtualize Table rows #774

Merged
merged 3 commits into from
Sep 21, 2023
Merged

add option to virtualize Table rows #774

merged 3 commits into from
Sep 21, 2023

Conversation

giogonzo
Copy link
Member

@giogonzo giogonzo commented Sep 21, 2023

This PR adds support for virtualizing the rows in a Table, using @tanstack/react-virtual. Virtualization is opt-in and for the time being it can't be enabled when grouping is also enabled

Comment on lines 89 to 90
| { groupBy?: C[number]["accessor"]; virtualizeRows?: never }
| { groupBy?: never; virtualizeRows?: { estimateRowHeight: (index: number) => number } }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mutually exclusive for now as I didn't investigate how to support virtualizing tables with groupBy enabled

numberOfStickyColumns={stickyLeftColumnsIds.length}
/>,
...row.leafRows.map((row, index) => {
<Box style={{ height: tableHeight(height) }} ref={tableContainerRef} overflow="auto">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not 100% sure of the possible implications of adding an extra wrapper here

@giogonzo giogonzo force-pushed the virtualized-table-rows branch from 8978ee4 to 131315f Compare September 21, 2023 11:56
@giogonzo giogonzo force-pushed the virtualized-table-rows branch from 131315f to 826e7fa Compare September 21, 2023 12:10
@giogonzo giogonzo force-pushed the virtualized-table-rows branch from 826e7fa to 4d418b6 Compare September 21, 2023 13:07
@giogonzo giogonzo force-pushed the virtualized-table-rows branch from 4d418b6 to 437c8d4 Compare September 21, 2023 13:19
@giogonzo giogonzo force-pushed the virtualized-table-rows branch from 437c8d4 to ad34e35 Compare September 21, 2023 13:25
typeof virtualizeRowsConfig === "boolean" ? virtualizeRowsConfig : virtualizeRowsConfig != null;
const estimateSize =
typeof virtualizeRowsConfig === "boolean"
? () => 52
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure how to pick a proper default value here. In practice, testing it, it doesn't seem to change much

@giogonzo giogonzo force-pushed the virtualized-table-rows branch from 1022f4f to 187049f Compare September 21, 2023 15:04
@giogonzo giogonzo merged commit 636e908 into main Sep 21, 2023
1 check passed
@giogonzo giogonzo deleted the virtualized-table-rows branch September 21, 2023 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants