Skip to content

feat(rooms): add pagination to room lists #136

@nickmeinhold

Description

@nickmeinhold

Problem

`listPublicRooms()` and `listMyRooms()` both use `.limit(50)` with client-side sorting. When users create more than 50 rooms, the excess are silently dropped.

Suggested approach

  1. Add cursor-based pagination using Firestore `startAfter` / `endBefore`
  2. Create a Firestore composite index for `isPublic` + `updatedAt` and `ownerId` + `updatedAt` to enable server-side ordering
  3. Add "Load more" button or infinite scroll to RoomBrowser
  4. Consider showing total count in the tab header

Files

  • `lib/rooms/room_service.dart` — add pagination params (limit, startAfter cursor)
  • `lib/rooms/room_browser.dart` — infinite scroll or load-more UI

Context

Both reviewers flagged client-side sorting and unbounded queries in PR #133. The `.limit(50)` cap was added as a safety measure but pagination is needed for scale.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions