feat(auctions)!: consume cursor-paginated list endpoints (BV-029) - #6
Merged
Conversation
Adapts every consumer of the six now-paginated backend endpoints
(GET /auctions, /watchlist, /auctions/mine/bids, /auctions/{id}/bids,
/listings/mine, /listings/pending) to the new {items, nextCursor}
response shape.
Browse Auctions is genuinely lazy — useInfiniteQuery plus an
IntersectionObserver sentinel, with category/search moved server-side
into the query key so a match on an unloaded page is never missed.
Every other screen (My Bids, Watchlist, My Listings, the admin review
queue, dashboard/sidebar stats) shows an exact count or aggregate, so
those drain every page up front via a new useDrainedPages hook or an
inline cursor walk instead of exposing pagination UI.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WBf5EWVmeLL4uXWVTFmgwG
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
GET /auctions,/watchlist,/auctions/mine/bids,/auctions/{id}/bids,/listings/mine,/listings/pending— to the new{items, nextCursor}response shape.useInfiniteQuery+ anIntersectionObserversentinel (useInfiniteScrollTrigger), withcategory/searchmoved server-side into the query key so pagination never silently hides a match on an unloaded page.useDrainedPageshook for the TanStack Query consumers, an inline cursor walk for the three plain-useStateones (usePendingListings,SellerMyListings,SellerProfile/SellerDashboard) — rather than exposing pagination UI where correctness of a total depends on having loaded everything.src/types/openapi.d.tsfrom the backend's BV-029 contract (api:contract && api:types).Test plan
npm run build— cleannpm run lint— 0 errorstests/pagination.test.ts(7 tests) + full suite verify the underlying cursor contract this PR consumes/auctions?status=ACTIVE&limit=24returns exactly 24 items + anextCursorwhen more exist, andnextCursorisnullonce exhaustedMerge order
Depends on bidvault-backend PR #7 (
fix/bv-029-pagination) being onmasterfirst — this branch'sopenapi.d.tswas generated from that PR's contract.Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01WBf5EWVmeLL4uXWVTFmgwG