Repository navigation
feat(frontend): add Load more to History and queue from all pages - #1358
Merged
Merged
Conversation
…l loaded pages The History view could only show the first page of rows and told the user to narrow the date range when the API capped the result. The History API is gaining keyset paging (has_more / next_cursor, LeanerCloud#674), so the UI now offers a "Load more" button under the Purchase History table when the response reports has_more. Each click repeats the first page's filters with cursor=next_cursor, appends the rows, and re-renders both the history table and the Approval Queue from every loaded row. Rows repeated on a later page (an approval swept to expired between loads) replace their stale copy by purchase_id. The summary cards keep the first page's totals. The "results capped" banner is driven by has_more: hidden when Load more can reach the older rows, reworded to quote the actionable cap when truncated without more pages, and unchanged on servers that do not page yet, so this is a no-op until the backend ships LeanerCloud#674. Refs LeanerCloud#676 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jest cases with two pages: cursor and filters on the second request, row append, Approval Queue built from both pages, newest copy wins on a repeated purchase_id, a reload discarding an in-flight page, a failed page keeping the button for retry, and the banner text for each has_more shape. A Playwright spec clicks Load more against a mocked two-page /api/history. Refs LeanerCloud#676 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Conflicts: - frontend/src/history.ts: add/add in the import block; kept both the history-paging imports (this branch, LeanerCloud#676) and main's renderApprovalQueueLink/wireApprovalQueueLinks import (LeanerCloud#1331). The rest merged cleanly: loadHistory/viewPlanHistory keep main's fail-closed four-eyes default, queue links and per-table popovers, and still reset and update Load more paging; loadMoreHistory re-renders main's Approval Queue from all loaded pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Independent review (IAmJSD's agent, fresh context, given only the diff, the issue and the PR text): APPROVE Blocking:
|
Collaborator
Author
|
Local verification at
|
IAmJSD
marked this pull request as ready for review
October 24, 2026 19:08
Collaborator
Author
|
Marked ready and merged by IAmJSD's agent, at IAmJSD's request (IAmJSD reviewed the before/after screenshots; cristim is traveling), after the independent review and local verification above, all at |
IAmJSD
added a commit
to IAmJSD/cloud-commitments-platform
that referenced
this pull request
Oct 24, 2026
Conflicts: - frontend/src/history.ts: imports kept both (this branch's iconSvg and main's history-paging helpers from LeanerCloud#1358). Main (LeanerCloud#1394) moved the retry lineage links into renderLineageLinks() and appends them to the ops-hint badge; took main's structure and applied this branch's icons inside it: the ops hint uses iconSvg('alert-triangle') and both lineage links use iconSvg('rotate-cw') instead of the restored glyphs. - frontend/src/ladder.ts: imports kept both (iconSvg and main's openModal/closeModal from LeanerCloud#1372). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 24, 2026
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.
The Purchase History view could only show the first page of rows; when the API hit its row cap the UI showed a "Results are capped... Narrow the date range" banner and older rows were unreachable. This PR adds a "Load more" button that appends the next page using the keyset cursor from backend PR #1277 and re-renders both the history table and the Approval Queue from every loaded row. On servers that don't page yet it behaves exactly as today.
Refs #676
Partial: the visible fix depends on backend PR #1277 (keyset paging for #674), which is still a draft and not merged. Until it lands, the API never returns
has_more, so the button never appears.What changed
frontend/src/types.ts,frontend/src/api/types.ts:HistoryResponsegainshas_more,next_cursorandactionable_executions_limit;HistoryFiltersgainscursor.frontend/src/api/history.tssendscursor.frontend/src/history-paging.ts: pure helpers (nextHistoryCursor,mergeHistoryPages, which de-duplicates bypurchase_idkeeping the newest response, andhistoryTruncationMessage) plus the button state.frontend/src/history.ts:loadHistory/viewPlanHistoryreset paging and remember the first page's filters and cursor.loadMoreHistory()fetches the next page with the same filters pluscursor=next_cursor, appends the rows, and re-renders the history table and the Approval Queue from all loaded rows. The summary cards keep the first page's totals.has_more: hidden when Load more can reach the older rows, reworded to quote the actionable cap when truncated without more pages, and unchanged when the server doesn't sendhas_more.frontend/src/index.html: a hidden "Load more" button under#history-list;styles/tables.csscenters it.__tests__/history-load-more.test.ts, a cursor case inapi-history.test.ts, andtests-e2e/history-load-more.spec.ts.Why this approach
It follows the "Frontend follow-up" section of #1277 exactly: cursor rather than offset, de-dupe by
purchase_id, banner only when truncated and!has_more, summary from page 1. That way the two halves fit when the backend lands. The issue text asks foroffset, but #1277 deliberately uses a keyset cursor and rejectsoffsetwith a 400, so the frontend follows the backend contract. With nohas_morefield there is no button and the old banner text verbatim, so this is safe to merge before #1277. New logic lives in a small module becausehistory.tsis already about 2030 lines.Screenshots
Screenshots were taken before this branch was merged with main; before = main at a14dc8f. After is this branch. Both are headless Chromium at 1440x900 against the repo's mocked e2e API, with a mocked paging API (page 1: 3 rows with
has_more, page 2: 2 rows).elasticache, expired) are appended, the chips count 5 rows, and the summary cards are unchanged.Verification
Run on this branch's head
184dab7a:frontend/src/history.tsresolved, see the merge commit.history-load-more.test.ts(9 cases: two-page append with the same filters plus cursor, queue built from both pages, newest-copy-wins de-dupe, reload discards an in-flight page with no double fetch, failed page retry, button wiring, banner text perhas_moreshape) and a cursor case inapi-history.test.ts. Before the merge, the new tests passed with--randomize(34).e2e-local.sh: 201 passed, including the newhistory-load-more.spec.ts(clicks Load more against a mocked two-page/api/history).scripts/test-git-secrets-allowlist.sh: 137 pass, 0 fail.Notes for review
Overlaps
history.ts.history.ts, in different functions (they merge cleanly with this branch).history.tsand also editstables.css,index.htmland the history-truncation-notice tests; it merges cleanly with this branch.index.html.Note for the UI owner
This changes UI code that @cristim owns. IAmJSD reviewed the before/after screenshots and asked for it to be merged; any design point you disagree with can be a follow-up.
🤖 Generated with Claude Code