[Bug] PaymentModal abandons pending Stellar transactions instead of calling the existing cancelPayment - #162
Conversation
- Destructure cancelPayment from useStellarPayment and call it when
modal closes with a pending, unsubmitted transaction (confirm step
or Back button)
- Modify executePayment to return { success, cancelled, data } so the
modal can distinguish wallet rejection from other failures
- On wallet rejection: cancel the pending backend transaction and
return user to preview step instead of leaving the tx dangling
- Block overlay click and Escape dismissal during processing
(onPointerDownOutside / onEscapeKeyDown preventDefault)
- Update processing text to 'Waiting for wallet confirmation…'
- Add closingRef guard to make handleClose safe for multiple calls
- Back button now cancels the pending tx, ensuring initiate-back-
initiate does not create orphaned duplicate transactions
Fixes Deen-Bridge#76
|
@BountySpaghetti is attempting to deploy a commit to the Deen Bridge Team on Vercel. A member of the Team first needs to authorize it. |
|
Warning Review limit reached
Next review available in: 30 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Comment |
Description
This PR fixes #76 by wiring the existing
cancelPayment()intoPaymentModalso pending transactions are properly cleaned up instead of abandoned.Changes
hooks/useStellarPayment.jsexecutePaymentnow returns{ success: true, data }on success,{ success: false, cancelled: true }on wallet rejection, and{ success: false, cancelled: false }on other errors. This lets callers distinguish cancellation from failure without breaking the existing API surface (the only caller isPaymentModal).components/stellar/PaymentModal.jsxcancelPaymentfromuseStellarPayment()handleClose: callscancelPayment()when closing from a step that has a pending, unsubmitted transaction (confirm/preview); returns early during processing to prevent accidental dismissal; usesclosingRefguard so it is safe to call multiple timeshandleBack(new): callscancelPayment(), clearspaymentData, returns to preview — prevents duplicate orphaned transactions on initiate → back → initiatehandleConfirm: on wallet rejection (outcome.cancelled), cancels the pending backend transaction and returns to preview instead of leaving the tx dangling in error stepDialogContent: addedonPointerDownOutsideandonEscapeKeyDownthatpreventDefault()during the processing step, blocking accidental dismissal while a signature or submission is in flightAcceptance Criteria Fulfilled
DELETE /api/stellar/payment/transactions/:id