Skip to content

fix(ui): real server-side pagination for transactions (rant 2026-08-24T10:51:57) - #135

Merged
argszero merged 1 commit into
mainfrom
fix/tx-server-pagination
Aug 24, 2026
Merged

fix(ui): real server-side pagination for transactions (rant 2026-08-24T10:51:57)#135
argszero merged 1 commit into
mainfrom
fix/tx-server-pagination

Conversation

@argszero

Copy link
Copy Markdown
Owner

Summary

Fix the fake-pagination bug on the transactions page (host rant 2026-08-24T10:51:57): the frontend hardcoded page=1&page_size=100 and the pager used the loaded data.length (=100) as the total, so with 7320 real records in 24h the page showed "共 100 条" and only the first 100 were ever reachable.

Changes (all frontend):

  • loadTransactions() now sends the actual txTable.page / txTable.pageSize to /api/transactions?page=N&page_size=M and records loadedPage / loadedPageSize after each fetch
  • renderTransactions() refetches the requested page when local page/pageSize differs from the loaded one — page buttons, column sort, column filters and the page-size selector all flow through this guard
  • buildDataTable() gains an optional serverPaging: { total }: the pager shows the backend real total (COUNT(*) from wallet.rs) and computes page count from it; rows are the already-paginated page (no local slice). Other tables (api-keys, members, etc.) are unaffected — they don't pass serverPaging
  • Compact pager with ellipsis window (1 … p-1 p p+1 … N) when pages > 9 (7320/10 → 732 pages; rendering 732 buttons was unusable)
  • After paging to a page > 1, the list scrolls into view

Preserved (per rant requirements):

  • Summary bar and trend chart stay full-scale (backend SQL aggregation — unchanged)
  • CSV export keeps exporting the current filtered visible rows
  • Type tab / time-range filters are kept (they are already sent as query params; each tab/range change resets to page 1)

Related Issue

Host rant 2026-08-24T10:51:57.822556+08:00 (transactions page fake pagination → server-side paging). No GitHub issue.

Tests

  • cargo test all pass (146/146)
  • cargo fmt --check pass
  • cargo clippy --all-targets -- -D warnings pass
  • node --check on modified JS

Checklist

  • Branch naming follows convention (fix/tx-server-pagination)
  • Conventional Commits
  • Single responsibility (one bug), minimal change

…4T10:51:57)
Fake pagination bug: loadTransactions hardcoded page=1&page_size=100 and the
pager used the loaded data.length (=100) as the total, so with 7320 real
records only the first 100 were ever visible.
- loadTransactions now sends txTable.page / txTable.pageSize and records
loadedPage/loadedPageSize after each fetch
- renderTransactions refetches the requested page when local page/pageSize
differs from the loaded one (page buttons, sort, filters, page-size all
flow through this guard)
- buildDataTable gains optional serverPaging.total: pager shows the backend
total and page count from it; rows are the already-paginated page (no
local slice); other tables unaffected
- compact pager with ellipsis window (1 … p-1 p p+1 … N) when pages > 9
- scroll list into view after paging to a page > 1
- cache-bust 20260824-3
@argszero
argszero merged commit 052b60c into mainAug 24, 2026
1 check passed
@argszero
argszero deleted the fix/tx-server-pagination branch August 24, 2026 03:12
argszero added a commit that referenced this pull request Aug 25, 2026
…5T10:33:26) (#146)
Column filters (type/user/model/key/pts/status) on the transactions page
previously only filtered the currently loaded page locally, making results
untrustworthy across thousands of rows (regression of PR #135 pagination).
- backend: TxColFilters (model/user_name/key_name LIKE, status exact,
pts_min/pts_max range) flattened into TxQuery/TxTrendQuery; tx_where()
applies them joined to users/api_keys/keys; summary/total/trend all use
the same filtered SQL; type whitelist now also accepts withdraw (the UI
column filter offers it)
- frontend: loadTransactions() sends filter params on list + trend
requests; txFilterSig() guard reloads when filters change; renderTxSummary
always uses the now filter-aware backend summary
- test: transactions_column_filters (LIKE/exact/range/combined/trend)
- cache-bust 20260824-14
Co-authored-by: argszero <argszero@argszerodeMac-mini.local>
Sign up for freeto 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.

1 participant

@argszero