feat: stream list virtualization (#156) and tab-visibility polling pause (#157) - #643
Merged
Austinaminu2 merged 7 commits intoAug 27, 2026
Conversation
…pause/resume polling on tab hide/show, add isRefreshingAfterHidden flag
…t-virtual with flat fallback for <50 streams, overscan=4, dynamic heights
…, show isRefreshingAfterHidden indicator
…age, wire bulk-select, show isRefreshingAfterHidden indicator
|
@darcszn Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
6 tasks
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 #156
Closes #157
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Issue #156 — Stream List Virtualization
Problem
The dashboard and streams page rendered all stream cards in a flat list by calling .map() directly on arrays that can hold up to 1,000 items. With 500 streams, 500+ DOM nodes were created on mount, causing slow initial renders, high memory usage, and scroll jank on lower-end devices.
Solution
Introduced @tanstack/react-virtual (v3.14.10) for windowed rendering — only cards visible in the viewport (plus an overscan buffer) are in the DOM at any time.
Files changed
components/streams/virtual-stream-list.tsx (new)
A component that:
app/app/dashboard.tsx (updated)
Replaced the three all.map / received.map / sent.map blocks inside the All / Receiving / Sending tabs with .
app/app/streams/page.tsx (updated)
Replaced filtered.map(...) with . Bulk-select state is wired directly through the new props.
package.json (updated)
Added "@tanstack/react-virtual": "^3.14.10" to dependencies.
Acceptance criteria
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Issue #157 — Pause Polling When Tab Is Hidden
Problem
useStreams polled the Soroban RPC on a 30-second interval regardless of whether the browser tab was visible or hidden. Users who open multiple FlowStar tabs or leave the app in the background waste bandwidth, battery, and RPC rate-limit quota.
Solution
Used the Page Visibility API (document.visibilitychange) to pause the polling interval when the tab is hidden and immediately resume + refetch when it becomes visible again.
Files changed
hooks/use-page-visibility.ts (new)
A focused usePageVisibility({ onVisible, onHidden }) hook that:
hooks/use-streams.ts (updated)
Polling logic refactored into startPolling() and stopPolling() helpers to allow the visibility handlers to control the interval without re-running the main useEffect.
usePageVisibility integrated:
isRefreshingAfterHidden: boolean added to the CategorizedStreams return type.
The main polling useEffect checks document.hidden before starting — if the page loads in a hidden tab (e.g. Ctrl+click), polling stays paused until the tab is first focused.
useAutoWithdraw manages its own separate interval and is intentionally not touched — auto-withdraw scheduling is unaffected.
app/app/dashboard.tsx and app/app/streams/page.tsx (updated)
Both pages destructure isRefreshingAfterHidden from useStreams() and render a brief spinning Refreshing… indicator in the page header when it is true. The indicator uses aria-live="polite" for accessibility.
Acceptance criteria
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Changed files
┌────────────────────────────────────────────┬──────────┐
│ File │ Status │
├────────────────────────────────────────────┼──────────┤
│ hooks/use-page-visibility.ts │ New │
├────────────────────────────────────────────┼──────────┤
│ hooks/use-streams.ts │ Modified │
├────────────────────────────────────────────┼──────────┤
│ components/streams/virtual-stream-list.tsx │ New │
├────────────────────────────────────────────┼──────────┤
│ app/app/dashboard.tsx │ Modified │
├────────────────────────────────────────────┼──────────┤
│ app/app/streams/page.tsx │ Modified │
├────────────────────────────────────────────┼──────────┤
│ package.json │ Modified │
└────────────────────────────────────────────┴──────────┘