optimization/performance#48
Conversation
… enhancing readability
…nd improved query handling
…rsection handling
|
Thanks a lot for the PR! 🙏 I do have a few concerns:
For those reasons, I’m inclined not to merge this unless I can reliably reproduce the performance issue we’re trying to address. Thanks again for taking the time to put this together - it’s much appreciated! |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Hi, thanks a lot for the thoughtful feedback! 🙏 I did some additional testing and I think I understand why the issue is not reproducible on all devices. Let me share my findings step by step: 1. Performance difference by device/browser
2. Cause
3. Reproducing the issue
4. Upstream reference
So in short:
I completely understand the concerns about complexity and compatibility. I just wanted to clarify the motivation and show that this fix directly targets a real usability problem for Chrome users on mid-range hardware. Thanks again for taking the time to review this PR! 🙏 |
There was a problem hiding this comment.
Pull Request Overview
This PR introduces virtual scrolling to dramatically improve performance when rendering large numbers of badge icons. The virtualized grid renders only visible items on-demand, reducing DOM nodes and improving scroll performance, while maintaining responsive layout and adding graceful degradation for non-JavaScript users.
- Implements virtual scrolling using
virtual-scrollerlibrary to handle large datasets efficiently - Refactors search and ordering modules to work with callback-based architecture for better modularity
- Adds progressive image loading with caching and placeholder loaders for better UX
Reviewed Changes
Copilot reviewed 21 out of 24 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
webpack.config.js |
Extracts icon data processing and injects as global ICONS_DATA constant |
public/scripts/virtual-window.js |
New module implementing virtual scrolling with responsive grid computation |
public/scripts/icons.js |
New module for creating badge elements with progressive image loading and caching |
public/scripts/index.js |
Refactored main entry point to coordinate virtual window, search, and ordering |
public/scripts/search.js |
Refactored to use callback pattern and extract badge filtering logic |
public/scripts/ordering.js |
Refactored to support callbacks and expose sortBadges utility function |
public/scripts/copy.js |
Updated to use event delegation on virtual list container |
public/scripts/dom-utils.js |
Added getColumnsCount function for responsive grid calculations |
public/scripts/utils.js |
Added groupIntoRows utility for virtual scroller row grouping |
public/index.pug |
Updated template with loader, virtual list container, and noscript fallback |
public/stylesheet.css |
Updated grid styles and added loader styles |
package.json |
Added virtual-scroller@1.13.1 dependency |
| Various test files | Added comprehensive tests for new modules and updated existing tests |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Thanks for the insights! Let's merge this once the Safari issue is resolved :D |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Thanks so much for the quick reply and for agreeing to merge — that’s awesome news! 😉👍 I pushed a couple of small commits (style rollback + cleanup) and retested on iOS Safari — scrolling works fine on my side. The scrollbar just moves very subtly because the page is so tall (3300+ virtual items). It might look stuck, but it’s actually working — same as in the previous version. If I misunderstood and something else is happening, could you share a bit more detail? That would help me track it down. |
|
@developStorm friendly ping) Could you take a look at the comment above? |
feat: Virtual scrolling and performance optimization
Visual Review & Performance Test: You can quickly review the visual changes and compare loading/rendering performance by visiting the preview environment.
Open Preview on Netlify
Summary
This branch introduces a virtualized, responsive grid for badge rendering, improves perceived and actual performance (less DOM, faster reflows), refines search and ordering behavior, optimizes image loading, and updates tooling and tests. The overall goal is to make the UI smoother at scale while keeping the codebase more modular and testable.
Changes
New Features
virtual-window.jsand integratedvirtual-scroller (v1.13.1)to render badges in rows on demand.Improvements
Responsive Grid Computation:
virtual-scroller, as it lacks native Grid Layout support in its DOM version. This was achieved by dynamically computing the number of elements per row based on CSS variables (--grid-width,--grid-gap) and the container's width.utils.groupIntoRowsutility was introduced to group items into rows for the virtual scroller.Graceful Degradation:
<noscript>tag. This guarantees the page remains functional and accessible to users with JavaScript disabled.Image Loading Performance and UX:
icons.jsfile creates each grid item and:Ellipse) placeholder.object URLs, and caches them in-memory (imageCache).shield.ioserver within a session.Search Module Refactoring:
search.jswas refactored to work with the new rendering logic via the 'virtual window'.Ordering Module Refactor:
ordering.jsis now initialized withgetBadgesandonOrderChangecallbacks.sortBadges, allowing external callers to sort any list by the current selection; persists the preferred ordering except when relevance is active.Copy Button Handling Optimization:
copy.jscentralizes event handling via delegation on the virtual list container; preserves copy-as Markdown/HTML/Link options.Templating Updates and Loader:
index.pugnow includes a loader image and updated containers (virtual-list,grid-rows-container) to cooperate with virtualization.Dependency and Tooling Updates:
simple-iconsupgraded from 15.8.0 to 15.10.0.virtual-scroller@1.13.1.jest.config.jsaddsmoduleNameMapperfor image imports to support new icons loader behavior in tests.Testing:
Notes