feat(P2): paginate email list — default 50 threads, Load more button #42

Merged
guettlibot merged 1 commits from task/p2-email-list-pagination into main 2026-05-14 08:09:06 +00:00
guettlibot commented 2026-05-14 08:08:04 +00:00 (Migrated from codeberg.org)

Implements P2 from the improvement plan.

observeThreads and observeEmails previously returned every row with
no limit, streaming thousands of emails into memory as the mailbox grew.

Changes:

  • lib/core/repositories/email_repository.dart: add {int limit = 50}
    named param to observeEmails and observeThreads.
  • lib/data/repositories/email_repository_impl.dart: pass ..limit(limit)
    to the Drift select statement in both methods.
  • lib/ui/screens/email_list_screen.dart: add _limit = 50 state
    (increments by 50 via "Load more" button); _buildThreadList shows a
    TextButton('Load more') as the last row when threads.length == _limit.
  • Test fakes/mocks updated to match the new signature.

Closes #19 (P2)

Implements P2 from the improvement plan. `observeThreads` and `observeEmails` previously returned every row with no limit, streaming thousands of emails into memory as the mailbox grew. **Changes:** - `lib/core/repositories/email_repository.dart`: add `{int limit = 50}` named param to `observeEmails` and `observeThreads`. - `lib/data/repositories/email_repository_impl.dart`: pass `..limit(limit)` to the Drift select statement in both methods. - `lib/ui/screens/email_list_screen.dart`: add `_limit = 50` state (increments by 50 via "Load more" button); `_buildThreadList` shows a `TextButton('Load more')` as the last row when `threads.length == _limit`. - Test fakes/mocks updated to match the new signature. Closes #19 (P2)
Sign in to join this conversation.