feat: optimistic updates for pause/resume/cancel with rollback - #522
Open
ZacLou wants to merge 2 commits into
Open
feat: optimistic updates for pause/resume/cancel with rollback#522ZacLou wants to merge 2 commits into
ZacLou wants to merge 2 commits into
Conversation
…it-protocol#454) Applies immediate cache updates when the user clicks pause, resume, or cancel so the UI reflects the expected state before the transaction confirms. Rolls back on error. - lib/optimistic-updates.ts: optimisticStreamStatusUpdate, rollbackStreamStatus, optimisticWithdrawUpdate, rollbackWithdraw - StreamActions.run() now accepts optimisticStatus parameter - Pause passes 'paused', resume passes 'active', cancel passes 'cancelled' - On error, snapshot is restored and queries invalidated for refetch Addresses conduit-protocol#454
ZacLou
force-pushed
the
feat/optimistic-updates-454
branch
from
September 5, 2026 15:56
ef4105a to
d6867b8
Compare
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
Addresses #454
Problem
Stream actions (pause/resume/cancel) waited for the full simulate -> sign -> submit -> poll cycle before updating the UI. Users saw a spinner for 10+ seconds with no visual feedback.
Solution
lib/optimistic-updates.ts(new)Four helper functions:
optimisticStreamStatusUpdate(qc, address, newStatus)— updates the stream's cached info and list entry with the new status. Returns a snapshot for rollback.rollbackStreamStatus(qc, address, snapshot)— restores the previous cached value on error.optimisticWithdrawUpdate(qc, address, amount)— reduces the displayed withdrawable balance. Returns snapshot.rollbackWithdraw(qc, address, snapshot)— restores the previous balance on error.components/stream/StreamActions.tsxrun()now accepts an optionaloptimisticStatusparameter'paused', resume passes'active', cancel passes'cancelled'Behavior
Files changed
lib/optimistic-updates.ts(new)components/stream/StreamActions.tsx(run function + button handlers)