Skip to content

fix: freeze cancelled stream progress bar at mount time - #517

Open
Obetaebube3 wants to merge 1 commit into
conduit-protocol:mainfrom
Obetaebube3:fix-cancelled-stream-progress
Open

fix: freeze cancelled stream progress bar at mount time#517
Obetaebube3 wants to merge 1 commit into
conduit-protocol:mainfrom
Obetaebube3:fix-cancelled-stream-progress

Conversation

@Obetaebube3

Copy link
Copy Markdown

Closes #417

This PR fixes a bug where a cancelled stream's progress bar and percentage label would keep creeping toward 100% every time the page re-rendered or was reloaded.

Because the contract's StreamInfo does not currently expose a cancelled_at timestamp, this PR implements the fallback behavior of freezing the progress at min(now, endTime) captured exactly once when the component mounts.

Changes

StreamProgressBar.tsx

  • Added a mountTimeRef to capture the exact wall-clock time when the component mounts.
  • Updated the referenceMs calculation to freeze at Math.min(mountTime, endTime) for cancelled streams, preventing the CSS animation width from creeping forward.
  • Updated the referenceSec state to also freeze for cancelled streams, fixing the aria-valuenow accessibility attribute.

StreamCard.tsx

  • Added "use client" directive.
  • Added a mountSec state initialized at mount time (Date.now() / 1_000).
  • Updated the pctSnapshot logic for cancelled streams to freeze at Math.min(mountSec, endTime), preventing the text percentage label from climbing on subsequent renders.

Testing

  • Verified that active and paused streams retain their existing behaviors.
  • Verified that open-ended streams (endTime === 0) are properly handled without NaN or incorrect progress.

@drips-wave

drips-wave Bot commented Sep 4, 2026

Copy link
Copy Markdown

@Obetaebube3 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

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.

Bug: StreamProgressBar shows an ever-advancing bar for a *cancelled* stream on every re-render (no cancelledAt)

1 participant