bc-grid
GitHub

Infinite scroll

View source

Stream blocks from a server endpoint. The grid maintains an LRU cache of fetched blocks and prefetches the next block in the scroll direction; sort / filter / search refire the block stream from the start.

100,000 rows behind a block fetcher. Scroll fast and watch blocks load on demand.
Order #
Customer
Sales rep
Status
Amount
Opened
Region
Loading

Try this

  • Scroll fast — new blocks load on demand. Old blocks stay cached.
  • Click a sortable header — the cache invalidates, new blocks stream.
  • Search — same: blocks refresh against the filtered set.
  • No page chrome — pagination is silent and invisible to the user.

loadBlock vs loadPage

  • paged. The user navigates with chrome (page chevrons, page-size dropdown). One page is in memory at a time. Use this for long lists where the user knows roughly where they are heading.
  • infinite. The user scrolls. Multiple blocks stay cached for fluid back-scroll. Use this for exploratory data — financial transactions, log streams, audit trails.
  • Both are <BcServerGrid rowModel="…">. Switch rowModel at runtime — bc-grid handles the mode polymorphism.

The contract

  • loadBlock(query, ctx). Receives { blockStart, blockSize, view }. Returns { rows, blockStart, blockSize, totalRows?, hasMore? }. Honour ctx.signal for cancellation.
  • LRU cache. The grid caps cached blocks (default ~10 blocks ahead and behind the viewport). Tune via cacheLimit and prefetchAhead.
  • Auto-retry. On block failure, the grid retries with exponential backoff (1s, 2s, 4s). Override with autoRetryBlocks or onBlockError.