Glossary

Infinite Scroll

Older messages appear as you scroll up, without a “load more” button. Simple to describe, fiddly to build: the list grows at the top, the scroll position must not jump, and ten thousand messages cannot all live in the DOM.

General definition

Infinite Scroll replaces page numbers with a trigger: when the user nears the edge of the loaded content, the client requests the next batch and appends it. Social feeds load downward; chat loads upward, because the newest message sits at the bottom and history extends into the past. The trigger is usually an IntersectionObserver watching a sentinel element at the top of the list, or a scroll handler that fires when scrollTop drops under a threshold. The request must be guarded so that only one fetch is in flight at a time and the client knows when there is nothing older to load.

Four pieces make it work in a message list:

  • Cursor pagination. Each request asks for messages before a cursor (the oldest loaded message ID or timestamp) rather than page N, because new messages keep arriving and would shift offset-based pages. The response returns the batch plus the next cursor or a flag that the beginning has been reached. In XMPP this is Message Archive Management (XEP-0313) paged with Result Set Management
  • Scroll anchoring. Prepending items pushes the visible messages down. The client records the scroll height before the insert and restores the offset after it, or relies on CSS overflow-anchor where the browser supports it
  • Virtualization. Only the rows near the viewport are rendered; libraries such as TanStack Virtual and react-window recycle DOM nodes, which keeps memory flat and scrolling smooth on long histories. Variable-height messages, images that load late and reply previews make height estimation the hard part
  • Bottom behaviour. Stay pinned to the newest message while the user is at the bottom, but do not pull them down when they are reading history; show a “new messages” pill instead

Deep links complicate the model: jumping to a search result or a replied-to message from months ago means loading a window around that message and then paging in both directions. Unread catch-up after a long absence is the mirror case, where the client needs the first unread message rather than the latest one and must page forward from there. Both are reasons to design the chat history API around cursors in either direction from the start rather than around “last N”.

Accessibility and analytics deserve a thought. Screen readers need announcements when content is inserted, keyboard users need focus to stay put, and because there is no page boundary, “how far did people read?” has to be measured from cursor depth rather than page views. Where the content is finite and shallow, plain pagination is still the better choice.

Designing a chat interface? Start from the ready-made Ethora React chat UI kit and match it to your brand.

In the Ethora ecosystem

Ethora’s chat components implement this pattern on top of the server-side message archive: the React and React Native UI load history in pages as the user scrolls up, resolve unread catch-up from the first unread message rather than the newest, and keep the view anchored while older messages are inserted. Because the archive is a read-only database on the server with configurable retention, history is the same on every device a user signs in from, and message search can jump into the middle of a long room.

Developers building their own interface combine the same history API with the UI kit pieces they want, with state for the loaded window living in their own store or in the component. Retention and per-user erasure settings decide how far back the scroll can go.

Get started

Start from a ready-made chat UI

Prebuilt React chat components you can restyle to your brand and connect to real-time messaging.

See the chat UI kit
Free tier available Enterprise SLA No vendor lock-in