feat: virtualize data table rows when pagination is disabled#8899
feat: virtualize data table rows when pagination is disabled#8899kirangadhave merged 9 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Bundle ReportChanges will increase total bundle size by 15.86kB (0.06%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: marimo-esmAssets Changed:
Files in
|
|
nice, looks very good! |
There was a problem hiding this comment.
Pull request overview
Adds row virtualization to the frontend data table when pagination is disabled and the dataset is large, reducing DOM load while keeping headers sticky.
Changes:
- Introduce
@tanstack/react-virtualand wireDataTableBodyto render virtualized rows (with overscan) whenpagination=falseand rows exceed a threshold. - Add
useScrollContainerHeightto manage the table wrapper’smax-heightfor sticky headers and virtualization (including header-size observation). - Add tests and a global
ResizeObserverstub for the vitest/jsdom environment.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Locks new @tanstack/react-virtual dependency and updated resolution graph. |
| frontend/package.json | Adds @tanstack/react-virtual. |
| frontend/src/components/data-table/types.ts | Adds constants for virtualization thresholds and fallback measurements. |
| frontend/src/components/data-table/renderers.tsx | Implements virtualized rendering in DataTableBody via useVirtualizer. |
| frontend/src/components/data-table/hooks/use-scroll-container-height.ts | New hook to manage wrapper max-height and observe header resize when virtualizing. |
| frontend/src/components/data-table/data-table.tsx | Enables virtualization when pagination is disabled and row count exceeds threshold; uses new hook. |
| frontend/src/components/data-table/tests/data-table.test.tsx | Adds basic tests covering virtualization on/off conditions. |
| frontend/src/tests/setup.ts | Adds a global ResizeObserver stub for tests. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
frontend/src/components/data-table/hooks/use-scroll-container-height.ts
Outdated
Show resolved
Hide resolved
frontend/src/components/data-table/__tests__/data-table.test.tsx
Outdated
Show resolved
Hide resolved
|
🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.21.2-dev79 |
📝 Summary
🔍 Description of Changes
Added a
useScrollContainerHeighthookDataTableBodynow uses theuseVirtualizerhook from@tanstack/react-virtualfor rendering virtualized rowadded constants for default row height, header height, etc. based on tailwind css values. In practice these are just fallbacks, we read from DOM.
Scrollbar currently spans the full container (header + body) due to sticky header inside the scroll container (happens with virtualize and maxHeight). Ideally we would separate the header and body rendering so scroll bar is show only for body, but it adds complexity to sync column widths in two tables.
Find won't work for offscreen rows, but table search should help with that.
No API change
Screen.Recording.2026-03-27.at.11.24.21.AM.mov