feat: implement virtualized list for large dataset display (#175) - #185
Merged
elizabetheonoja-art merged 1 commit intoAug 20, 2026
Merged
Conversation
elizabetheonoja-art
merged commit Aug 20, 2026
8956c75
into
Utility-Protocol:main
9 of 10 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
**Close #175
Summary of the issue
Displaying large datasets (thousands of meter readings) in the current UI causes significant performance degradation and lag. Rendering the entire list at once locks the main thread, resulting in poor scroll performance and an unresponsive user experience.
Root cause
The application currently renders every row of the dataset directly into the DOM regardless of whether it is visible in the viewport. For datasets exceeding a few hundred items, this overwhelms the browser's rendering engine and consumes excessive memory.
Solution implemented
Implemented a windowed/virtualized rendering strategy that only renders the DOM nodes currently visible in the viewport (plus a small overscan buffer to prevent flickering). As the user scrolls, rows are recycled and repositioned using GPU-accelerated CSS transforms (
translateY), ensuring smooth scrolling even with 10,000+ items.Key changes made
useVirtualListhook (src/hooks/useVirtualList.ts) for robust state management, supporting:ResizeObserver-like measurement approach per row.sessionStorage(perfect for when users navigate away and back).onLoadMoretriggers).VirtualListcomponent (src/components/ui/VirtualList.tsx) that consumes the hook and handles ARIA accessibility, empty states, and loading indicators.src/styles/virtual-list.css) with strict CSS containment (contain: strict/layout) to isolate the rendering cost of the list from the rest of the page.tests/hooks/useVirtualList.test.tsandtests/components/VirtualList.test.tsx) covering large dataset efficiency, measurements, and state handling.Any trade-offs or considerations
estimatedItemHeight. If the estimate is wildly inaccurate, the scrollbar might "jump" as the user scrolls. I've set a sensible default of48px, which can be overridden per list.react-virtualto keep bundle size minimal and tailored precisely to the project's state architecture.Testing steps (how to verify the fix)
npm run dev).virtual-list-rowDOM nodes that update theirtranslateYposition dynamically instead of thousands of nodes.aria-rowcount,aria-label) are appropriately passed to screen readers.npm run test) to verify the new virtual list tests pass.Please kindly review this task. If there are any corrections, improvements, adjustments, or merge conflicts that you notice regarding my implementation, I'd really appreciate your feedback. I'd also love to hear your overall review of my work on this branch.
Thank you!