Skip to content

Add optimistic UI update for buy transaction before on-chain confirmation #571

Description

@Chucks1093

Summary

After a user submits a buy transaction the UI waits for on-chain confirmation before updating holdings, making the experience feel sluggish. An optimistic update should immediately reflect the pending purchase in the holdings list, then reconcile with the confirmed state once the transaction settles.

Scope

  • On buy submission, add the purchased quantity to the user's holding for that creator in the React Query cache optimistically
  • Mark the entry as pending with a visual indicator (e.g. muted opacity or spinner badge)
  • On transaction confirmation, remove the pending indicator and refetch to sync with the server
  • On transaction failure, roll back the optimistic update and show the existing error toast

Acceptance Criteria

  • Holding count updates immediately on buy submission
  • Pending state visually distinguishable from confirmed holdings
  • Confirmed state matches server data after refetch
  • Optimistic update rolled back on failure

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions