fix: stream not-found, future-stream progress, and infinite scroll - #531
Merged
Chuks-coderr merged 1 commit intoAug 28, 2026
Conversation
…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
|
@princessoladele is attempting to deploy a commit to the Chuks7 Team on Vercel. A member of the Team first needs to authorize it. |
|
@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! 🚀 |
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
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:
getStreamedAmountwas referenced bygetRemainingBalanceand imported byStreamProgressBarbut was never defined/exported fromsrc/lib/sorostream.ts. Every stream detail page render threw aReferenceError, which bypassed the existing "Stream Not Found" UI entirely and left the user on a blank screen.Fix: Export
getStreamedAmountfromsrc/lib/sorostream.tswith correct semantics:floor(flowRate × elapsed_seconds)endTimecancelledAttimestamp when availableTests: New file
src/lib/__tests__/getStreamedAmount.test.ts(14 assertions).#482 — Future streams show non-zero progress on dashboard card
Root cause:
StreamProgressBarcomputedelapsed = now - startand relied on an implicitMath.max(0, …)to prevent a negative percentage. The intent was not explicit, and the missinggetStreamedAmountexport 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
StreamHistorycomponent already implements infinite scroll via anIntersectionObserversentinel, but jsdom (the vitest test environment) does not shipIntersectionObserver. All four infinite-scroll test cases were failing with aReferenceError.Fix: Add a no-op
IntersectionObserverstub tosrc/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
Pre-existing failures in
WalletConnect.test.tsx,sessionError.test.ts, andMilestoneNotifications.test.tsxare caused by duplicate exports insrc/lib/freighter.ts— unrelated to this PR.Files changed
src/lib/sorostream.tsgetStreamedAmountexportcomponents/StreamProgressBar.tsx[start, end]clampingsrc/test/setup.tsIntersectionObserverstubsrc/lib/__tests__/getStreamedAmount.test.tscomponents/__tests__/StreamProgressBar.test.tsxcomponents/__tests__/StreamHistory.test.tsxcomponents/StreamHistory.tsxcloses #483
closes #482
closes #457