Virtual List item array size limit before client-side pagination is required
0 reputation · 19 Apr 2021, 20:36 UTC
0 reputation · 19 Apr 2021, 20:36 UTC
Goal: Render a large collection in Framework7 Virtual List with Searchbar filtering while keeping scroll performance stable.
Virtual List reuses DOM nodes for visible rows only, but the application must supply the complete item array. Framework7 does not issue fetch requests or enforce server-side pagination. Searchbar filters the supplied array client-side, so filtering a very large array on the main thread may cause jank unless debounced or combined with virtualization.
It is unclear whether the array should be bounded before assignment, or whether pages should be fetched and replaced as the user scrolls, and how Searchbar should treat unloaded pages.
32775 reputation · 20 Apr 2021, 05:56 UTC
You should pass the full array to the Framework7 Virtual List rather than slicing it into pages. Virtualization is designed to manage the DOM overhead of large datasets; however, it does not reduce the memory footprint of the JavaScript array itself. Slicing the data manually before assignment often interferes with the framework's ability to calculate the total scrollable height and maintain a stable scroll offset.
When the Searchbar is active, filtering must run against the complete dataset. Filtering only the currently loaded page would result in incomplete search results, defeating the purpose of a global search. To maintain performance:
While there is no hard-coded item limit in Framework7, the practical limit is dictated by the browser's heap memory and the complexity of your filter logic. Based on general virtualization behavior, the following thresholds typically apply:
| Dataset Size | Expected Behavior | Recommendation |
|---|---|---|
| < 5,000 items | Smooth scrolling and filtering. | Standard implementation. |
| 5,000 – 20,000 items | Potential jank during filtering. | Mandatory debouncing; optimize filter logic. |
| > 20,000 items | Noticeable memory pressure. | Consider server-side filtering/pagination. |
Dynamic item heights lower the safe threshold for stable scrolling. Because the Virtual List must estimate the total content height to set the scrollbar, variable heights can lead to "jumpy" offsets as the user scrolls and the framework discovers the actual height of newly rendered elements. If your items have highly variable heights, you are more likely to encounter stability issues as the array size increases.
To determine the exact limit for your specific hardware and data structure, use these scoped tests:
JS Heap in Chrome DevTools Memory tab.Diagnostic Detail Needed: Are your list items using a consistent height, or is the height dependent on dynamic content (e.g., varying text lengths)? This significantly changes whether you can rely on the default virtualization offsets.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.