Skip to content

Fix stale price data usage in TransactionReview#51

Open
aniket866 wants to merge 1 commit intoDjedAlliance:mainfrom
aniket866:fix/transaction-review-stale-price-data
Open

Fix stale price data usage in TransactionReview#51
aniket866 wants to merge 1 commit intoDjedAlliance:mainfrom
aniket866:fix/transaction-review-stale-price-data

Conversation

@aniket866
Copy link

@aniket866 aniket866 commented Jan 23, 2026

  • implement this fix: Stale Price Data Usage

  • Location: TransactionReview.jsx

-Issue: Price data (tradeDataBuySc) is fetched once on component mount. If the user waits 5 minutes before clicking "Pay", the price is outdated.

  • Impact: Transaction failure (if the contract checks limits) or bad execution price for the user.

  • Fix: Implement a "Refresh Timer" (e.g., every 15s) or re-fetch quote immediately before signing.

@Zahnentferner

Summary by CodeRabbit

  • New Features
    • Native token trade data now automatically refreshes every 15 seconds during transaction review to provide up-to-date pricing information.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 23, 2026

📝 Walkthrough

Walkthrough

A React effect is added to TransactionReview.jsx that establishes a 15-second polling interval to refresh trade data for native tokens, with automatic cleanup and error handling.

Changes

Cohort / File(s) Summary
Native Token Trade Data Refresh
stablepay-sdk/src/widget/TransactionReview.jsx
Adds a new effect that periodically fetches and updates trade data for native tokens. Sets up a 15-second interval triggered when transaction exists and selected token is native. Includes error handling with warning logs and cleanup logic on unmount or dependency changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Hop, hop, hooray!
A rabbit's delight, trade data so bright,
Every fifteen seconds, prices take flight,
Native tokens dance in the interval's glow—
Fresh data flows where the transactions go! 🌿

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: fixing stale price data usage in the TransactionReview component, which directly aligns with the PR objective of implementing periodic price refresh to prevent outdated quotes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant