Skip to content

perf(history): lazy-load the transaction history list#393

Merged
MastaP merged 2 commits into
mainfrom
perf/history-lazy-load
Jun 26, 2026
Merged

perf(history): lazy-load the transaction history list#393
MastaP merged 2 commits into
mainfrom
perf/history-lazy-load

Conversation

@MastaP

@MastaP MastaP commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Why

A long-lived wallet — the swap wallet especially — accrues tens of thousands of history rows. TransactionHistoryModal formatted every entry (Date.toLocaleDateString/toLocaleTimeString per row — slow at 10k) and rendered them all as motion.div rows, freezing the page on open.

What

Render a newest-first window (40) and grow it via an IntersectionObserver sentinel as the user scrolls near the bottom (lazy loading). Both the per-row formatting (useMemo now slices to visibleCount) and the DOM node count stay bounded regardless of history length. The window resets on each open.

Pure render-side fix — no SDK/data change (getHistory() stays in-memory). tsc -b + lint green.

Note

This bounds the client render. The backend's large-inventory reads under load are a separate, infra-side concern (see the related GET /v1/inventory degradation).

MastaP added 2 commits June 26, 2026 02:22
A long-lived wallet (the swap wallet) accrues tens of thousands of history rows.
TransactionHistoryModal formatted EVERY entry (Date.toLocale* per row) and
rendered them ALL as motion.div rows, freezing the page on open.

Render a newest-first window (40) and grow it via an IntersectionObserver
sentinel as the user scrolls near the bottom — so both the per-row formatting and
the DOM node count stay bounded regardless of history length. Resets on each open.

No SDK/data change (getHistory stays in-memory); this is a pure render-side fix.
@MastaP MastaP merged commit 436e62f into main Jun 26, 2026
7 checks passed
@MastaP MastaP deleted the perf/history-lazy-load branch June 26, 2026 08:40
Sign up for free to 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