Performance: Pagination component
MEDIUM IMPACT
Pagination affects page load speed and interaction responsiveness by controlling how much content is rendered and how often the DOM updates.
<ul class="pagination"> <li class="page-item"><a class="page-link" href="#">1</a></li> <li class="page-item disabled"><span class="page-link">...</span></li> <li class="page-item"><a class="page-link" href="#">10</a></li> </ul>
<ul class="pagination"> <li class="page-item"><a class="page-link" href="#">1</a></li> <li class="page-item"><a class="page-link" href="#">2</a></li> <li class="page-item"><a class="page-link" href="#">3</a></li> <!-- Many more page items rendered at once --> </ul>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Render all page links at once | High (many nodes) | Multiple per update | High (many elements) | [X] Bad |
| Render limited page links with ellipsis | Low (few nodes) | Single per update | Low (few elements) | [OK] Good |
| Re-render entire pagination on click | High (many nodes updated) | Multiple per click | High | [X] Bad |
| Update only changed page item on click | Low (few nodes updated) | Single per click | Low | [OK] Good |