Extend infinite scroll to portal list surfaces (Closes #972)#974
Merged
Conversation
Portal list surfaces beyond Assets silently capped at their first page.
This adds offset-based infinite scroll (Load-more fallback) to Collections,
Feedback (Recent/Worklist/General), Resources, Knowledge Pages, Settings >
Users, and Settings > Changelog, so each can display its full contents.
Shared infrastructure so no surface reimplements paging:
- useOffsetInfiniteQuery + nextOffset/flattenPages/toPaginated/paginatedFetch
in ui/src/api/portal/hooks/infinite.ts (Assets now consumes it too)
- InfiniteFooter control (scroll sentinel + useInfiniteScroll + Load more)
Endpoints returning a non-PaginatedResponse envelope adapt at the fetch
boundary so all surfaces share one merge/dedupe path.
Backend:
- resources: handleList honors a client limit, clamped to MaxListLimit
- config changelog: Changelog gains offset+total (postgres OFFSET/COUNT,
file store, admin envelope {entries,total}) clamped to maxChangelogLimit,
so older entries are reachable
- swagger regenerated
DataHub Catalog/Context Docs browse is intentionally left single-page: the
upstream "*" browse sends no sort criteria, so offset paging can drop or
duplicate rows and catalog browse returns no total. The constraint is
documented in datahub.ts pending a stable upstream sort/cursor.
dev/seed.sql seeds >page-size volume per surface (validated via migrate-check).
MSW mocks and unit tests updated; new shared hooks/component covered by tests.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #974 +/- ##
==========================================
+ Coverage 89.03% 89.06% +0.02%
==========================================
Files 424 424
Lines 48581 48598 +17
==========================================
+ Hits 43256 43283 +27
+ Misses 3549 3543 -6
+ Partials 1776 1772 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Closes #972. The Assets library loads all items via infinite scroll, but the other portal list surfaces fetched only their first page, so a user or deployment with more items than one page silently could not reach the rest. This PR extends the same pattern to every affected surface that has a stable, offset-capable backend, so each list can display its full contents.
Surfaces now paginated
Each of these accumulates pages as you scroll, with a "Load more" button as the fallback and indicator, matching the Assets library:
Shared infrastructure
Paging is implemented once and reused, rather than reimplemented per page:
ui/src/api/portal/hooks/infinite.tsholdsuseOffsetInfiniteQueryplus the pure helpersnextOffset,flattenPages,toPaginated, andpaginatedFetch. The Assets hooks now consume this shared module too (the paging helpers moved out ofassets.ts, which re-exports them for backward compatibility).ui/src/components/InfiniteFooter.tsxis the shared Load-more control: it owns the scroll sentinel and wiresuseInfiniteScroll, and renders nothing once every page is loaded.created_at/updated_atDESC list cannot double-count a row when an insert shifts the window. Paging stops on the latest page'stotalor an empty trailing page, so "Load more" cannot spin forever.PaginatedResponseenvelope (Resources{resources,total}, Users{users,total}, Knowledge Pages{pages,total}, Changelog{entries,total}) adapt their response to the shared shape at the fetch boundary viatoPaginated, so all surfaces share one merge, dedupe, and stop-condition path.Backend
handleListnow honors a client-suppliedlimit, clamped to a newresource.MaxListLimit. Previously it ignored the clientlimitand always used the default page size.configstore.Store.Changeloggainedoffsetand a full-historytotal(PostgresOFFSETplus aCOUNT(*), the file store, and the admin handler), returned as a{entries,total}envelope and clamped tomaxChangelogLimit. Older entries beyond the most-recent window are now reachable.internal/apidocsare updated for the newlimitparameter and the changelog response shape.DataHub Catalog and Context Docs (not wired)
Catalog and Context Docs browse are intentionally left single-page. They page against an external DataHub via a
query:"*"search that sends no sort criteria, so results come back in relevance/segment order that is not stable across requests: numeric offset paging over it can drop or duplicate rows between fetches, and catalog browse returns nototal. Infinite scroll here would be a correctness regression worse than the current cap, so it stays gated on the upstream mcp-datahub client gaining a stable sort or a scroll/search-after cursor. The constraint is documented inui/src/api/portal/datahub.ts. Search remains the escape hatch.Tests and verification
InfiniteFootercontrol have unit tests; the feedback component tests are updated to the infinite hooks.dev/seed.sqlseeds more than one page of resources, collections, threads, knowledge pages, users, and changelog entries so every surface exercises pagination in the dev environment. The seed is validated against a real Postgres bymake migrate-check.limit/offsetso the e2e and screenshot pipelines exercise paging.make verifypasses locally (unit tests with race, coverage and patch coverage, golangci-lint, gosec, govulncheck, semgrep, CodeQL, frontend tests and e2e, swagger-check, migrate-check).Notes
limit: 200request was silently collapsed to 20 by the store, so the tag facet is now more complete on first load, not less.Follow-up (out of scope)
Real pagination for the currently unbounded "fetch-all" endpoints (My Prompts, Admin Prompts, Prompt Review Queue, Tools, and the Settings lists) remains a lower-priority follow-up, and DataHub-backed browse is blocked on the upstream paging guarantee described above.