Skip to content

Latest commit

Β 

History

History
43 lines (29 loc) Β· 1.48 KB

File metadata and controls

43 lines (29 loc) Β· 1.48 KB

Closes #417

PR Title

feat(client): Add infinite scroll pagination to Home page


🎯 Summary

Implements infinite scroll pagination on the Home page to improve performance and user experience as the number of raffles grows. Replaces the single large fetch with incremental page loading triggered by an IntersectionObserver sentinel.

πŸ“‹ Problem

The Home page currently loads all raffles in a single request, causing:

  • Long initial load times as the raffle catalog grows
  • Large DOM rendering overhead
  • Poor perceived performance on slower connections
  • No way to browse incrementally

✨ Solution

An infinite scroll system with the following components:

  1. useIntersectionObserver hook β€” Reusable IntersectionObserver wrapper
  2. Sentinel-based loading β€” Auto-fetches next page when user scrolls near bottom
  3. Scroll position preservation β€” Restores scroll position on browser back navigation
  4. Deduplication β€” Prevents duplicate cards between overlapping requests

πŸš€ Features

Core Behavior

  • βœ… Auto-load on scroll β€” Next page fetches when sentinel enters viewport (200px rootMargin)
  • βœ… Skeleton loading state β€” RaffleCardSkeleton grid shown while fetching more
  • βœ… "No more raffles" indicator β€” Shown when all items are loaded
  • βœ… Duplicate prevention β€” Map deduplication by raffle ID
  • βœ… Scroll restoration β€” sessionStorage cache preserves position on back navigation

Technical Details