feat(wave): cursor pagination for the issues list (#635)#1911
Merged
Conversation
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.
Contributor
There was a problem hiding this comment.
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
nextCursorparsing andcursorquery serialization to shared pagination utilities. - Updates the issues page infinite-scroll loader to prefer
pagination.nextCursorbefore falling back topage + 1. - Adds unit coverage for cursor serialization and
nextCursorschema 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates the Wave issues list to keyset/cursor pagination, paging the infinite scroll via the backend's
pagination.nextCursorinstead of incrementingpage.Deep page-based scrolling drove the slow
OFFSETquery path onGET /api/issuesthat 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.nextCursorand?cursor=).What changed
types/pagination.ts: optionalcursorinput param +nextCursorresponse field (string | null).toPaginationParamsemits thecursorquery param.issues-page.sveltegetMoreIssues: preferspagination.nextCursor; falls back topage + 1for sorts the backend doesn't cursor-paginate (points) and for older backends that don't returnnextCursor.Backwards compatibility
Fully backwards-compatible and safe to deploy in either order relative to the backend: when no
nextCursoris returned (old backend, orpointssort) 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
types/pagination.unit.test.ts:toPaginationParamscursor serialization/encoding;paginationSchemaaccepts string/null/absentnextCursor.npm run test:unit→ 93 passed.npm run check→ 0 errors. eslint/prettier clean on changed files.🤖 Generated with Claude Code