Skip to content

Sell quote and gas estimation pause fix#425

Merged
RanaBug merged 1 commit intostagingfrom
feat/PRO-3681/transaction-status-pulse
Oct 6, 2025
Merged

Sell quote and gas estimation pause fix#425
RanaBug merged 1 commit intostagingfrom
feat/PRO-3681/transaction-status-pulse

Conversation

@RanaBug
Copy link
Collaborator

@RanaBug RanaBug commented Oct 6, 2025

Description

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Summary by CodeRabbit

  • New Features

    • The sell flow now intelligently pauses during critical steps (e.g., awaiting signature or executing), preventing background refreshes and gas re-calculations for a smoother, more stable experience.
    • The home screen reflects the paused state, keeping quotes and details consistent until actions complete.
  • Bug Fixes

    • Prevents unexpected quote or gas updates while confirming/executing a sell, reducing interruptions and accidental retries.
    • Ensures the app reliably resumes normal updates after completion, errors, or navigation, avoiding lingering paused states.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 6, 2025

Walkthrough

Introduces a pause mechanism for the sell flow. HomeScreen manages isSellFlowPaused and gates refresh/auto-refresh. PreviewSell accepts setSellFlowPaused, updates it based on transaction phases, and propagates pause to gas estimation. useGasEstimation adds an isPaused flag to suppress estimations during paused states.

Changes

Cohort / File(s) Summary of changes
Sell flow pause integration
src/apps/pulse/components/App/HomeScreen.tsx, src/apps/pulse/components/Sell/PreviewSell.tsx
HomeScreen adds isSellFlowPaused state; guards refresh and auto-refresh when paused; passes setSellFlowPaused to PreviewSell. PreviewSell adds optional prop setSellFlowPaused, toggles it during signature/execution, short-circuits refresh while paused, and ensures cleanup resets.
Gas estimation hook
src/apps/pulse/hooks/useGasEstimation.ts
Adds optional isPaused prop; integrates isPaused into estimation gating, effects, and callbacks to prevent concurrent/undesired gas estimations while paused.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant HS as HomeScreen
  participant PS as PreviewSell
  participant GE as useGasEstimation

  U->>HS: Open Sell flow
  HS->>PS: Render with setSellFlowPaused(...)
  note over HS: Maintains isSellFlowPaused<br/>Gates refresh/auto-refresh

  PS->>PS: Detect isWaitingForSignature / isExecuting
  PS->>HS: setSellFlowPaused(true)
  HS->>HS: Suppress refresh while paused

  PS->>GE: useGasEstimation({ ..., isPaused: true })
  GE-->>PS: Skip estimation (paused)

  U->>PS: Confirm tx / execution completes
  PS->>HS: setSellFlowPaused(false)
  PS->>GE: useGasEstimation({ ..., isPaused: false })
  GE-->>PS: Estimate gas (active)

  HS->>HS: Auto-refresh resumes (not paused)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • IAmKio
  • vignesha22

Poem

A rabbit taps pause on the selling spree,
Hops in place while gas runs free.
When signatures finish and blocks align,
It thumps resume—now all is fine.
Burrow to burrow the quotes refresh,
Carrots secured, the flow’s enmesh. 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description only contains placeholder hyphens under the Description and How Has This Been Tested sections and lacks any substantive details, so it does not fulfill the repository’s template requirements. It provides no summary of what was changed or how the changes were tested, leaving reviewers without essential context. Although the Types of changes section marks this as a bug fix, the critical descriptive and testing information is missing. This makes the description insufficient for an effective review. Please complete the Description section with a clear summary of the implemented fixes and fill out the How Has This Been Tested section with detailed test steps, environments, and results as specified by the template. Optionally include any relevant screenshots or additional context to aid the review.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title “Sell quote and gas estimation pause fix” accurately reflects the primary change of correcting the pause logic for both sell quote refreshing and gas estimation behavior. It is concise and specific, targeting the core functionality touched by the pull request without extraneous details. A reader scanning the history can quickly grasp what was fixed.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/PRO-3681/transaction-status-pulse

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.

@cloudflare-workers-and-pages
Copy link

Deploying x with  Cloudflare Pages  Cloudflare Pages

Latest commit: bc1f544
Status: ✅  Deploy successful!
Preview URL: https://81e136ee.x-e62.pages.dev
Branch Preview URL: https://feat-pro-3681-transaction-st.x-e62.pages.dev

View logs

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/apps/pulse/components/Sell/PreviewSell.tsx (1)

350-425: Consider removing redundant pause state updates.

The manual calls to setSellFlowPaused at lines 361, 383, and 423 are redundant since the effect at lines 118-123 already synchronizes the pause state whenever isWaitingForSignature or isExecuting changes. The effect will automatically call setSellFlowPaused(true) when isExecuting becomes true (line 360) and setSellFlowPaused(false) when it becomes false (lines 382, 422).

Remove the manual calls for cleaner code:

     setIsWaitingForSignature(true);
     setIsExecuting(true);
-    if (setSellFlowPaused) setSellFlowPaused(true);
 
     try {
           setIsTransactionSuccess(true);
           setIsWaitingForSignature(false);
           setIsExecuting(false);
-          if (setSellFlowPaused) setSellFlowPaused(false);
 
           // Clean up the batch from kit after successful execution
       setIsExecuting(false);
-      if (setSellFlowPaused) setSellFlowPaused(false);
     }
   };
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 724a464 and bc1f544.

📒 Files selected for processing (3)
  • src/apps/pulse/components/App/HomeScreen.tsx (6 hunks)
  • src/apps/pulse/components/Sell/PreviewSell.tsx (9 hunks)
  • src/apps/pulse/hooks/useGasEstimation.ts (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: unit-tests
  • GitHub Check: lint
  • GitHub Check: build
🔇 Additional comments (10)
src/apps/pulse/hooks/useGasEstimation.ts (3)

18-26: LGTM! Well-designed pause mechanism.

The isPaused flag is properly integrated with clear defaults and correct parameter passing. This design allows callers to pause gas estimation during critical transaction phases without additional complexity.


46-48: Correct guard logic for paused state.

The short-circuit condition properly prevents gas estimation when paused, avoiding unnecessary network calls and potential state conflicts during transaction execution.


141-141: Dependencies correctly include isPaused.

Both the useCallback and useEffect dependency arrays properly include isPaused, ensuring the hook responds to pause state changes and maintains correct closure semantics.

Also applies to: 153-158

src/apps/pulse/components/App/HomeScreen.tsx (4)

121-121: LGTM! Clear pause state management.

The isSellFlowPaused state provides centralized control for pausing sell flow operations in HomeScreen.


184-186: Correct guard conditions prevent refresh during pause.

The guards properly prevent manual and sell offer refreshes when the sell flow is paused, ensuring data consistency during transaction execution.

Also applies to: 195-201


738-759: Auto-refresh correctly respects pause state.

The auto-refresh logic is properly gated by isSellFlowPaused, preventing background updates during critical transaction phases. The dependency array is complete.


801-801: Pause control correctly delegated to PreviewSell.

Passing setSellFlowPaused enables PreviewSell to control the pause state based on transaction phases, establishing proper parent-child state coordination.

src/apps/pulse/components/Sell/PreviewSell.tsx (3)

40-52: LGTM! Clean prop integration and computed pause state.

The setSellFlowPaused prop is properly typed as optional and the computed isPaused state correctly combines transaction phases for gas estimation.

Also applies to: 81-82


118-130: LGTM! Declarative pause state synchronization.

The effect at lines 118-123 provides clean, declarative synchronization of the pause state to the parent component based on isWaitingForSignature and isExecuting. The cleanup effect ensures proper reset on unmount, preventing stale pause states.


226-229: Correct guard prevents refresh during transaction phases.

Blocking refresh while waiting for signature or executing prevents quote staleness and potential user confusion during active transactions.

@RanaBug RanaBug merged commit 165ea46 into staging Oct 6, 2025
6 checks passed
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