Skip to content

Fix post-purchase state for buy-now edition listings - #178

Draft
mxjxn with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-purchase-notification-issue
Draft

Fix post-purchase state for buy-now edition listings#178
mxjxn with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-purchase-notification-issue

Conversation

Copilot AI commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Buy-now purchases on edition listing pages were confirming without any clear success state, then leaving the page in a stale intermediate state. The result was an incorrect remaining-count display until a hard refresh, even though the purchase had succeeded.

  • Post-purchase flow

    • Keep the buyer on the listing page after purchase confirmation instead of immediately redirecting away.
    • Show an inline success message on the listing page once the transaction confirms.
  • Edition supply accounting

    • Correct the optimistic totalSold update for ERC1155 listings by applying purchaseQuantity * totalPerSale, so the remaining count matches the on-chain purchase semantics.
    • Mark the listing finalized only when the recomputed remaining supply reaches zero.
  • Duplicate confirmation handling

    • Gate purchase side effects by purchaseHash so the confirmation effect only runs once per transaction.
    • Avoid repeated optimistic increments and repeated post-confirmation refresh behavior.
  • Buyer list synchronization

    • Restore optimistic buyer-list updates on listing pages by always registering the buyer-added handler.
    • Keep the buyers list in sync with the confirmed purchase before the background refetch catches up.
const totalPerSale = parseInt(prev.totalPerSale || "1");
const copiesPurchased = purchaseQuantity * totalPerSale;
const newTotalSold = currentTotalSold + copiesPurchased;

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cryptoart-studio-mvp Ready Ready Preview, Comment Jun 26, 2026 4:45pm

Request Review

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.

2 participants