Skip to content

feat(wave): cursor pagination for the issues list (#635)#1911

Merged
efstajas merged 1 commit into
mainfrom
feat/issues-cursor-pagination-635
May 31, 2026
Merged

feat(wave): cursor pagination for the issues list (#635)#1911
efstajas merged 1 commit into
mainfrom
feat/issues-cursor-pagination-635

Conversation

@efstajas
Copy link
Copy Markdown
Contributor

Summary

Migrates the Wave issues list to keyset/cursor pagination, paging the infinite scroll via the backend's pagination.nextCursor instead of incrementing page.

Deep page-based scrolling drove the slow OFFSET query path on GET /api/issues that pinned DB pool connections and caused production 5xx incidents (drips-network/wave#635). Cursor pagination is O(limit) regardless of depth.

Depends on the backend PR drips-network/wave#637 (which adds pagination.nextCursor and ?cursor=).

What changed

  • types/pagination.ts: optional cursor input param + nextCursor response field (string | null).
  • toPaginationParams emits the cursor query param.
  • issues-page.svelte getMoreIssues: prefers pagination.nextCursor; falls back to page + 1 for sorts the backend doesn't cursor-paginate (points) and for older backends that don't return nextCursor.

Backwards compatibility

Fully backwards-compatible and safe to deploy in either order relative to the backend: when no nextCursor is returned (old backend, or points sort) it transparently uses page-based loading. The infinite-scroll terminator (hasNextPage) and match-count badge (total) are unchanged — both are still returned by the backend in cursor mode.

Testing

  • New types/pagination.unit.test.ts: toPaginationParams cursor serialization/encoding; paginationSchema accepts string/null/absent nextCursor.
  • npm run test:unit → 93 passed.
  • npm run check → 0 errors. eslint/prettier clean on changed files.

🤖 Generated with Claude Code

Drives the issues-page infinite scroll via the backend's
pagination.nextCursor (keyset, O(limit)) instead of incrementing page,
which on deep scrolls triggered the slow OFFSET path that pinned DB pool
connections (drips-network/wave#635).

- pagination types: optional cursor input param + nextCursor response field
- toPaginationParams emits cursor
- getMoreIssues prefers nextCursor, falling back to page+1 for sorts the
  backend doesn't cursor-paginate (points) and older backends

Backwards-compatible: when no nextCursor is returned (old backend / points
sort) it transparently falls back to page-based loading.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates Wave issue infinite scrolling toward cursor/keyset pagination while keeping offset pagination as a fallback for unsupported sorts or older backends.

Changes:

  • Adds optional nextCursor parsing and cursor query serialization to shared pagination utilities.
  • Updates the issues page infinite-scroll loader to prefer pagination.nextCursor before falling back to page + 1.
  • Adds unit coverage for cursor serialization and nextCursor schema handling.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/lib/utils/wave/types/pagination.ts Extends pagination schema/input utilities for cursor support.
src/lib/utils/wave/types/pagination.unit.test.ts Verifies cursor query params and optional/null nextCursor parsing.
src/lib/components/wave/issues-page/issues-page.svelte Uses cursor-based loading for subsequent issue pages when available.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@efstajas efstajas merged commit 7acda86 into main May 31, 2026
7 of 9 checks passed
@efstajas efstajas deleted the feat/issues-cursor-pagination-635 branch May 31, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants