Skip to content

fix: stream not-found, future-stream progress, and infinite scroll - #531

Merged
Chuks-coderr merged 1 commit into
SoroStream:mainfrom
princessoladele:fix/457-482-483-infinite-scroll-progress-not-found
Aug 28, 2026
Merged

fix: stream not-found, future-stream progress, and infinite scroll#531
Chuks-coderr merged 1 commit into
SoroStream:mainfrom
princessoladele:fix/457-482-483-infinite-scroll-progress-not-found

Conversation

@princessoladele

Copy link
Copy Markdown

Summary

Fixes three issues in a single PR. All changes are isolated and independently verifiable.


#483 — Stream detail page: blank screen for non-existent stream IDs

Root cause: getStreamedAmount was referenced by getRemainingBalance and imported by StreamProgressBar but was never defined/exported from src/lib/sorostream.ts. Every stream detail page render threw a ReferenceError, which bypassed the existing "Stream Not Found" UI entirely and left the user on a blank screen.

Fix: Export getStreamedAmount from src/lib/sorostream.ts with correct semantics:

  • Active stream → floor(flowRate × elapsed_seconds)
  • Paused stream → frozen at the moment of pausing
  • Future stream (now < startTime) → 0 (clamps elapsed to 0)
  • Ended stream → capped at endTime
  • Cancelled stream → capped at cancelledAt timestamp when available

Tests: New file src/lib/__tests__/getStreamedAmount.test.ts (14 assertions).


#482 — Future streams show non-zero progress on dashboard card

Root cause: StreamProgressBar computed elapsed = now - start and relied on an implicit Math.max(0, …) to prevent a negative percentage. The intent was not explicit, and the missing getStreamedAmount export meant the cancelled-stream path was also broken.

Fix: Replace the implicit clamp with an explicit effectiveNow = Math.min(Math.max(now, start), end) so the progress is unambiguously bounded to [start, end] regardless of stream state. Future streams always display exactly 0%.

Tests: Two new cases added to components/__tests__/StreamProgressBar.test.tsx.


#457 — Infinite scroll: tests failing with IntersectionObserver not defined

Root cause: The StreamHistory component already implements infinite scroll via an IntersectionObserver sentinel, but jsdom (the vitest test environment) does not ship IntersectionObserver. All four infinite-scroll test cases were failing with a ReferenceError.

Fix: Add a no-op IntersectionObserver stub to src/test/setup.ts (the global vitest setup file). The stub never fires intersection callbacks, which is sufficient for the tests to render the sentinel element and assert on its presence without triggering the observer.


Test results

Metric Before After
Tests passed 251 269
Tests failed 10 0
Test files (build errors, pre-existing) 3 3

Pre-existing failures in WalletConnect.test.tsx, sessionError.test.ts, and MilestoneNotifications.test.tsx are caused by duplicate exports in src/lib/freighter.ts — unrelated to this PR.

Files changed

File Change
src/lib/sorostream.ts Add getStreamedAmount export
components/StreamProgressBar.tsx Explicit [start, end] clamping
src/test/setup.ts Add IntersectionObserver stub
src/lib/__tests__/getStreamedAmount.test.ts New — 14 test cases
components/__tests__/StreamProgressBar.test.tsx 2 new future-stream test cases
components/__tests__/StreamHistory.test.tsx No logic change; tests now pass
components/StreamHistory.tsx No logic change

closes #483
closes #482
closes #457

…oroStream#457 SoroStream#482 SoroStream#483)

**SoroStream#483 — Stream detail: not-found causes blank screen / ReferenceError**
The root cause was that `getStreamedAmount` was used by `getRemainingBalance`
and imported by `StreamProgressBar`, but was never defined in sorostream.ts.
This caused a `ReferenceError` on every stream detail page render, which
manifested as a blank screen for non-existent stream IDs (the error boundary
never got a chance to show the friendly 'Stream Not Found' UI).

Fix: export `getStreamedAmount` from `src/lib/sorostream.ts` with correct
semantics: active → elapsed × flowRate; paused → frozen at pause moment;
ended → capped at endTime; cancelled → capped at cancelledAt; future → 0.

Tests: src/lib/__tests__/getStreamedAmount.test.ts (new, 14 assertions)

**SoroStream#482 — Future streams show non-zero progress percentage**
`StreamProgressBar` computed `elapsed = now - start` without explicitly
clamping `now` to the stream's start time. While Math.max(0, …) prevented a
negative value reaching the bar, the intent was not clear and the
`getStreamedAmount` missing export meant cancelled-stream progress was
also broken.

Fix: use `effectiveNow = Math.min(Math.max(now, start), end)` so the
progress calculation is unambiguously clamped to [start, end] for all stream
states, and future streams always show exactly 0%.

Tests: added two test cases to components/__tests__/StreamProgressBar.test.tsx

**SoroStream#457 — Stream history: replace load-more button with infinite scroll**
The `StreamHistory` component already had the IntersectionObserver sentinel
implemented, but tests were failing with `ReferenceError: IntersectionObserver
is not defined` because jsdom does not provide it.

Fix: add a no-op `IntersectionObserver` mock to `src/test/setup.ts` (the
global vitest setup file) so all tests run without the error. The four
infinite-scroll test cases in `StreamHistory.test.tsx` now pass.

closes SoroStream#483
closes SoroStream#482
closes SoroStream#457
@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

@princessoladele is attempting to deploy a commit to the Chuks7 Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@princessoladele 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! 🚀

Learn more about application limits

@Chuks-coderr
Chuks-coderr merged commit d07a24f into SoroStream:main Aug 28, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants