Skip to content

Conversation

@gomesalexandre
Copy link
Contributor

@gomesalexandre gomesalexandre commented Sep 2, 2025

Description

Removes swapper status screen (a.k.a does what it says on the box)

Issue (if applicable)

closes #10011

Risk

High Risk PRs Require 2 approvals

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

Medium - touches trade execution slice

Testing

  • Execute a trade
  • Confirm after signing the swap Tx, a toast is toasted with pending state, and users are routed back to input screen

Engineering

  • ^

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)
  • ^

Screenshots (if applicable)

https://jam.dev/c/d4dd63e9-25bc-4590-b761-b542916326d1

Summary by CodeRabbit

  • New Features

    • Show execution price in Swap Details after a successful swap.
    • Toast notifications for swap events that open the Action Center when clicked and navigate back to trade input.
  • Improvements

    • Context-aware toast duration (short when Action Center is open, otherwise persistent).
    • Prevent duplicate toasts for the same swap for cleaner UX.

@gomesalexandre gomesalexandre requested a review from a team as a code owner September 2, 2025 09:36
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 2, 2025

📝 Walkthrough

Walkthrough

Integrates Action Center notifications into trade execution and swap subscriber flows (toasts with deduplication, open Action Center on click, navigate to trade input), and adds a memoized execution-price row to SwapDetails shown when a swap succeeds.

Changes

Cohort / File(s) Summary
Trade execution notifications
src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
After detecting sellTxHash dispatch, clears sell amount, shows a SwapNotification toast (guarded by toast id), opens Action Center on click and navigates to TradeRoutePaths.Input; added selectors/context and extended effect deps.
Action Center subscriber toast dedupe
src/hooks/useActionCenterSubscribers/useSwapActionSubscriber.tsx
Prevents duplicate toasts by checking toast.isActive(swap.id) before showing Pending/Success/Failed toasts; existing toast payloads and handlers preserved.
Swap details UI
src/components/Layout/Header/ActionCenter/components/Details/SwapDetails.tsx
Adds memoized execution price row (computed from actualBuyAmountCryptoPrecision / sellAmountCryptoPrecision) shown on Success; extends swap destructuring and renders Amount.Crypto row when available.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant TE as useTradeExecution
  participant Store as Redux
  participant SUB as useSwapActionSubscriber
  participant Toast as SwapNotification
  participant AC as ActionCenter
  participant Nav as Router

  U->>TE: Confirm final "sign to swap"
  TE->>Store: dispatch(sellTxHash)
  TE->>Store: dispatch(tradeInput.setSellAmountCryptoPrecision('0'))
  TE->>Toast: show SwapNotification (id=swap.id) [guard: not active]
  Toast-->>U: Click notification
  U->>AC: openActionCenter()
  TE->>Nav: navigate(TradeRoutePaths.Input)

  Note over Store,SUB: Swap status updates in store
  SUB->>Toast: show Success/Failed toast (guard: not active)
  Toast-->>U: Click opens Action Center
  Toast->>AC: openActionCenter()
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Assessment against linked issues

Objective Addressed Explanation
Remove status screen in favor of notifications; create action card after final tx; open Action Center; navigate back to form (#10011)
Show toast with transaction tracking for swap lifecycle: Pending/Success/Failed (#10011)
Prevent duplicate toasts for same swap (#10011)
Trade form reverts to initial state (#10011) Code navigates to Input and clears sell amount, but full form reset not verified in this diff.

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Add execution price row rendering (src/components/Layout/Header/ActionCenter/components/Details/SwapDetails.tsx) Execution price display is a UI detail not required by #10011 (notification/status-screen removal); appears unrelated to the notification/navigation objectives.

Possibly related PRs

Suggested labels

high risk

Suggested reviewers

  • NeOMakinG
  • premiumjibles

Poem

I tapped my paw—no waiting screen,
A toast hopped out, alert and keen.
Back to inputs I nimbly bound,
The Center hums, the swap is found.
A carrot count — the price is clear,
Hop, click, and cheer! 🥕✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat_swap_details_execution_price_2

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@gomesalexandre gomesalexandre changed the base branch from develop to feat_swap_details_execution_price September 2, 2025 09:36
@gomesalexandre gomesalexandre marked this pull request as draft September 2, 2025 09:38
@gomesalexandre gomesalexandre marked this pull request as ready for review September 2, 2025 09:52
@gomesalexandre gomesalexandre changed the title feat: action center swap details add execution price feat: swapper remove status screen Sep 2, 2025
Base automatically changed from feat_swap_details_execution_price to develop September 2, 2025 13:52
Copy link
Collaborator

@NeOMakinG NeOMakinG left a comment

Choose a reason for hiding this comment

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

https://jam.dev/c/582bc557-a4f4-45cb-be82-b81375061b5b

Does the do, are we ready to remove the status screen, no informations needed?

I think this won't be compatible with multi hop now, as we will be redirecting to the input after the first execution

Also, do we want to cleanup and remove all unused files?

@gomesalexandre
Copy link
Contributor Author

Does the do, are we ready to remove the status screen, no informations needed?

Does the do, are we ready to remove the status screen, no informations needed?

Was also thinking about that re: THOR/Chainflip execution state, missing CoW surplus confetti
Will triple-check with @shapeshift/product we're ready to ditch it before we merge this 🙏🏽 !

I think this won't be compatible with multi hop now, as we will be redirecting to the input after the first execution

Think that's absolutely fine, most new features (e.g swap actions) are pretty much already incompatible as it stands

Also, do we want to cleanup and remove all unused files?

IMO, probably worth keeping for some time to make things easier (say we want to bring some logic from e.g surplus, or some status logic over to notification center)

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/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx (1)

173-202: Gate toast + input reset + redirect to the final hop only (prevents multi-hop interruption).
Issue #10011 specifies reverting the form after the final transaction is initiated. Today, this runs on every SellTxHash, which will prematurely bounce users during multi-hop. Also, avoid leaking unknown toast render props into SwapNotification and prefer replace-navigation.

Apply:

       execution.on(TradeExecutionEvent.SellTxHash, ({ sellTxHash }) => {
         txHashReceived = true
         dispatch(
           tradeQuoteSlice.actions.setSwapSellTxHash({ hopIndex, sellTxHash, id: confirmedTradeId }),
         )
-        dispatch(tradeInput.actions.setSellAmountCryptoPrecision('0'))
-
-        const swap = activeSwapId ? swapsById[activeSwapId] : undefined
-        if (swap) {
-          // No double-toasty
-          if (toast.isActive(swap.id)) return
-
-          toast({
-            id: swap.id,
-            status: 'info',
-            render: ({ onClose, ...props }) => {
-              const handleClick = () => {
-                onClose()
-                openActionCenter()
-              }
-
-              return (
-                <SwapNotification
-                  // eslint-disable-next-line react-memo/require-usememo
-                  handleClick={handleClick}
-                  swapId={swap.id}
-                  onClose={onClose}
-                  {...props}
-                />
-              )
-            },
-          })
-        }
-
-        navigate(TradeRoutePaths.Input)
+        const isFinalHop = hopIndex === tradeQuote.steps.length - 1
+        if (isFinalHop) {
+          dispatch(tradeInput.actions.setSellAmountCryptoPrecision('0'))
+
+          const swap = activeSwapId ? swapsById[activeSwapId] : undefined
+          if (swap && !toast.isActive(swap.id)) {
+            toast({
+              id: swap.id,
+              status: 'info',
+              render: ({ onClose }) => {
+                const handleClick = () => {
+                  onClose()
+                  openActionCenter()
+                }
+                return (
+                  <SwapNotification
+                    // eslint-disable-next-line react-memo/require-usememo
+                    handleClick={handleClick}
+                    swapId={swap.id}
+                    onClose={onClose}
+                  />
+                )
+              },
+            })
+          }
+
+          navigate(TradeRoutePaths.Input, { replace: true })
+        }
       })
  • Behavior: keeps current single-hop UX identical; prevents early redirect on first hop; dedupes toast by id; avoids spreading unknown props.

Please confirm this matches product’s acceptance for multi-hop; if you’re intentionally punting on multi-hop, keep as-is and we’ll follow up later.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 54447b3 and 2387014.

📒 Files selected for processing (2)
  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx (6 hunks)
  • src/hooks/useActionCenterSubscribers/useSwapActionSubscriber.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/hooks/useActionCenterSubscribers/useSwapActionSubscriber.tsx
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)

**/*.{ts,tsx}: ALWAYS use Result<T, E> pattern for error handling in swappers and APIs
ALWAYS use Ok() and Err() from @sniptt/monads for monadic error handling
ALWAYS use custom error classes from @shapeshiftoss/errors
ALWAYS provide meaningful error codes for internationalization
ALWAYS include relevant details in error objects
ALWAYS wrap async operations in try-catch blocks
ALWAYS use AsyncResultOf utility for converting promises to Results
ALWAYS provide fallback error handling
ALWAYS use timeoutMonadic for API calls
ALWAYS provide appropriate timeout values for API calls
ALWAYS handle timeout errors gracefully
ALWAYS validate inputs before processing
ALWAYS provide clear validation error messages
ALWAYS use early returns for validation failures
ALWAYS log errors for debugging
ALWAYS use structured logging for errors
ALWAYS include relevant context in error logs
Throwing errors instead of using monadic patterns is an anti-pattern
Missing try-catch blocks for async operations is an anti-pattern
Generic error messages without context are an anti-pattern
Not handling specific error types is an anti-pattern
Missing timeout handling is an anti-pattern
No input validation is an anti-pattern
Poor error logging is an anti-pattern
Using any for error types is an anti-pattern
Missing error codes for internationalization is an anti-pattern
No fallback error handling is an anti-pattern
Console.error without structured logging is an anti-pattern

**/*.{ts,tsx}: ALWAYS use camelCase for variables, functions, and methods
ALWAYS use descriptive names that explain the purpose for variables and functions
ALWAYS use verb prefixes for functions that perform actions
ALWAYS use PascalCase for types, interfaces, and enums
ALWAYS use descriptive names that indicate the structure for types, interfaces, and enums
ALWAYS use suffixes like Props, State, Config, Type when appropriate for types and interfaces
ALWAYS use UPPER_SNAKE_CASE for constants and configuration values
ALWAYS use d...

Files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)

**/*.tsx: ALWAYS wrap components in error boundaries
ALWAYS provide user-friendly fallback components in error boundaries
ALWAYS log errors for debugging in error boundaries
ALWAYS use useErrorToast hook for displaying errors
ALWAYS provide translated error messages in error toasts
ALWAYS handle different error types appropriately in error toasts
Missing error boundaries in React components is an anti-pattern

**/*.tsx: ALWAYS use PascalCase for React component names
ALWAYS use descriptive names that indicate the component's purpose
ALWAYS match the component name to the file name
Flag components without PascalCase
Flag default exports for components

Files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
**/*

📄 CodeRabbit inference engine (.cursor/rules/naming-conventions.mdc)

**/*: ALWAYS use appropriate file extensions
Flag files without kebab-case

Files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
**/use*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/naming-conventions.mdc)

**/use*.{ts,tsx}: ALWAYS use use prefix for custom hooks
ALWAYS use descriptive names that indicate the hook's purpose
ALWAYS use camelCase after the use prefix for custom hooks

Files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/react-best-practices.mdc)

**/*.{tsx,jsx}: ALWAYS use useMemo for expensive computations, object/array creations, and filtered data
ALWAYS use useMemo for derived values and computed properties
ALWAYS use useMemo for conditional values and simple transformations
ALWAYS use useCallback for event handlers and functions passed as props
ALWAYS use useCallback for any function that could be passed as a prop or dependency
ALWAYS include all dependencies in useEffect, useMemo, useCallback dependency arrays
NEVER use // eslint-disable-next-line react-hooks/exhaustive-deps unless absolutely necessary
ALWAYS explain why dependencies are excluded if using eslint disable
ALWAYS use named exports for components
NEVER use default exports for components
KEEP component files under 200 lines when possible
BREAK DOWN large components into smaller, reusable pieces
EXTRACT complex logic into custom hooks
USE local state for component-level state
LIFT state up when needed across multiple components
USE Context for avoiding prop drilling
ALWAYS wrap components in error boundaries for production
ALWAYS handle async errors properly
ALWAYS provide user-friendly error messages
ALWAYS use virtualization for lists with 100+ items
ALWAYS implement proper key props for list items
ALWAYS lazy load heavy components
ALWAYS use React.lazy for code splitting
Components receiving props are wrapped with memo

Files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/react-best-practices.mdc)

USE Redux only for global state shared across multiple places

Files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
🧠 Learnings (15)
📓 Common learnings
Learnt from: NeOMakinG
PR: shapeshift/web#10231
File: src/components/AssetSearch/components/AssetList.tsx:2-2
Timestamp: 2025-08-08T15:00:49.887Z
Learning: Project shapeshift/web: NeOMakinG prefers avoiding minor a11y/UI nitpicks (e.g., adding aria-hidden to decorative icons in empty states like src/components/AssetSearch/components/AssetList.tsx) within feature PRs; defer such suggestions to a follow-up instead of blocking the PR.
Learnt from: gomesalexandre
PR: shapeshift/web#10206
File: src/config.ts:127-128
Timestamp: 2025-08-07T11:20:44.614Z
Learning: gomesalexandre prefers required environment variables without default values in the config file (src/config.ts). They want explicit configuration and fail-fast behavior when environment variables are missing, rather than having fallback defaults.
Learnt from: gomesalexandre
PR: shapeshift/web#10249
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:447-503
Timestamp: 2025-08-13T17:07:10.763Z
Learning: gomesalexandre prefers relying on TypeScript's type system for validation rather than adding defensive runtime null checks when types are properly defined. They favor a TypeScript-first approach over defensive programming with runtime validations.
Learnt from: gomesalexandre
PR: shapeshift/web#10276
File: src/hooks/useActionCenterSubscribers/useThorchainLpDepositActionSubscriber.tsx:61-66
Timestamp: 2025-08-14T17:51:47.556Z
Learning: gomesalexandre is not concerned about structured logging and prefers to keep console.error usage as-is rather than implementing structured logging patterns, even when project guidelines suggest otherwise.
Learnt from: gomesalexandre
PR: shapeshift/web#10413
File: src/components/Modals/FiatRamps/fiatRampProviders/onramper/utils.ts:29-55
Timestamp: 2025-09-02T14:26:19.028Z
Learning: gomesalexandre prefers to keep preparatory/reference code simple until it's actively consumed, rather than implementing comprehensive error handling, validation, and robustness improvements upfront. They prefer to add these improvements when the code is actually being used in production.
Learnt from: gomesalexandre
PR: shapeshift/web#10276
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:396-402
Timestamp: 2025-08-14T17:55:57.490Z
Learning: gomesalexandre is comfortable with functions/variables that return undefined or true (tri-state) when only the truthy case matters, preferring to rely on JavaScript's truthy/falsy behavior rather than explicitly returning boolean values.
Learnt from: gomesalexandre
PR: shapeshift/web#10206
File: src/lib/moralis.ts:47-85
Timestamp: 2025-08-07T11:22:16.983Z
Learning: gomesalexandre prefers console.error over structured logging for Moralis API integration debugging, as they find it more conventional and prefer to examine XHR requests directly rather than rely on structured logs for troubleshooting.
Learnt from: gomesalexandre
PR: shapeshift/web#10276
File: src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx:46-53
Timestamp: 2025-08-14T19:21:45.426Z
Learning: gomesalexandre does not like code patterns being labeled as "technical debt" and prefers neutral language when discussing existing code patterns that were intentionally moved/maintained for consistency.
📚 Learning: 2025-08-08T11:40:55.734Z
Learnt from: NeOMakinG
PR: shapeshift/web#10234
File: src/components/MultiHopTrade/components/TradeConfirm/TradeConfirm.tsx:41-41
Timestamp: 2025-08-08T11:40:55.734Z
Learning: In MultiHopTrade confirm flow (src/components/MultiHopTrade/components/TradeConfirm/TradeConfirm.tsx and related hooks), there is only one active trade per flow. Because of this, persistent (module/Redux) dedupe for QuotesReceived in useTrackTradeQuotes is not necessary; the existing ref-based dedupe is acceptable.

Applied to files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
📚 Learning: 2025-07-29T15:04:28.083Z
Learnt from: NeOMakinG
PR: shapeshift/web#10139
File: src/components/MultiHopTrade/components/TradeConfirm/components/ExpandableStepperSteps.tsx:109-115
Timestamp: 2025-07-29T15:04:28.083Z
Learning: In src/components/MultiHopTrade/components/TradeConfirm/components/ExpandableStepperSteps.tsx, the component is used under an umbrella that 100% of the time contains the quote, making the type assertion `activeTradeQuote?.steps[currentHopIndex] as TradeQuoteStep` safe. Adding conditional returns before hooks would violate React's Rules of Hooks.

Applied to files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
📚 Learning: 2025-08-08T11:41:36.971Z
Learnt from: NeOMakinG
PR: shapeshift/web#10234
File: src/components/MultiHopTrade/hooks/useGetTradeQuotes/hooks/useTrackTradeQuotes.ts:88-109
Timestamp: 2025-08-08T11:41:36.971Z
Learning: In MultiHopTrade Confirm flow (src/components/MultiHopTrade/components/TradeConfirm/TradeConfirm.tsx), the Confirm route does not remount; navigating away goes to the swapper input page. Therefore, persistent deduplication across remounts for quote tracking is unnecessary; a ref-based single-mount dedupe is sufficient.

Applied to files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
📚 Learning: 2025-08-22T15:07:18.021Z
Learnt from: kaladinlight
PR: shapeshift/web#10326
File: src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx:37-41
Timestamp: 2025-08-22T15:07:18.021Z
Learning: In src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx, kaladinlight prefers not to await the upsertBasePortfolio call in the Base chain handling block, indicating intentional fire-and-forget behavior for Base portfolio upserts in the THORChain LP completion flow.

Applied to files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
📚 Learning: 2025-08-04T16:02:27.360Z
Learnt from: NeOMakinG
PR: shapeshift/web#10171
File: src/components/MultiHopTrade/components/TradeConfirm/components/ExpandedStepperSteps.tsx:458-458
Timestamp: 2025-08-04T16:02:27.360Z
Learning: In multi-hop swap transactions, last hop sell transactions might not be detected by the swapper (unlike buy transactions which are always known immediately). The conditional stepSource logic for last hop buy transactions (`isLastHopSellTxSeen ? stepSource : undefined`) serves as defensive programming for future multi-hop support with intermediate chains, even though multi-hop functionality is not currently supported in production.

Applied to files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
📚 Learning: 2025-07-24T09:43:11.699Z
Learnt from: CR
PR: shapeshift/web#0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-07-24T09:43:11.699Z
Learning: Applies to packages/swapper/src/swappers/*/{*.ts,endpoints.ts} : Avoid side effects in swap logic within swapper implementation files.

Applied to files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
📚 Learning: 2025-08-22T14:59:04.889Z
Learnt from: kaladinlight
PR: shapeshift/web#10326
File: src/hooks/useActionCenterSubscribers/useGenericTransactionSubscriber.tsx:105-111
Timestamp: 2025-08-22T14:59:04.889Z
Learning: In the ShapeShift web Base chain handling, the await pattern inside forEach in useGenericTransactionSubscriber is intentional to delay the entire action completion flow (not just fetchBasePortfolio) for Base chain transactions. The user kaladinlight wants everything below the Base portfolio refresh - including dispatch, query invalidation, and toast notifications - to also be delayed by ~10 seconds to accommodate Base's degraded node state.

Applied to files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
📚 Learning: 2025-08-22T13:16:12.721Z
Learnt from: NeOMakinG
PR: shapeshift/web#10323
File: src/pages/RFOX/hooks/useRfoxRewardDistributionActionSubscriber.tsx:104-105
Timestamp: 2025-08-22T13:16:12.721Z
Learning: In src/pages/RFOX/hooks/useRfoxRewardDistributionActionSubscriber.tsx, the guard `if (!actions[actionId]) return` before upserting completed reward distributions is intentional product behavior. NeOMakinG confirmed that the system should only show completion notifications for reward distributions that were previously seen in a pending state, not for distributions the user missed during the pending phase.

Applied to files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
📚 Learning: 2025-08-10T21:09:25.643Z
Learnt from: premiumjibles
PR: shapeshift/web#10215
File: src/components/MultiHopTrade/hooks/useGetTradeRateInput.ts:65-67
Timestamp: 2025-08-10T21:09:25.643Z
Learning: In the MultiHopTrade components, `selectInputBuyAsset` and `selectInputSellAsset` selectors from `tradeInputSlice` always return defined values because they have default values in the initial state (BTC for buyAsset, ETH for sellAsset, with fallback to defaultAsset). Null checks for these assets are unnecessary when using these selectors.

Applied to files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
📚 Learning: 2025-08-15T07:51:16.374Z
Learnt from: gomesalexandre
PR: shapeshift/web#10278
File: src/components/AssetHeader/hooks/useQuickBuy.ts:97-99
Timestamp: 2025-08-15T07:51:16.374Z
Learning: The selectPortfolioUserCurrencyBalanceByAssetId selector in src/state/slices/portfolioSlice/selectors.ts expects a filter object with an assetId property, not a raw AssetId string. The selector signature is (state: ReduxState, filter) where filter should have an assetId property. This pattern is consistent across portfolio selectors that use selectAssetIdParamFromFilter. Passing a filter object like { assetId: someAssetId } is the correct usage pattern.

Applied to files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
📚 Learning: 2025-08-15T07:51:16.374Z
Learnt from: gomesalexandre
PR: shapeshift/web#10278
File: src/components/AssetHeader/hooks/useQuickBuy.ts:97-99
Timestamp: 2025-08-15T07:51:16.374Z
Learning: The selectPortfolioUserCurrencyBalanceByAssetId selector in src/state/slices/portfolioSlice/selectors.ts accepts a filter object with an assetId property, not a raw AssetId string. The selector signature is (state: ReduxState, filter) where filter is expected to have an assetId property. Passing a filter object like { assetId: someAssetId } is the correct usage pattern.

Applied to files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
📚 Learning: 2025-08-15T07:51:16.374Z
Learnt from: gomesalexandre
PR: shapeshift/web#10278
File: src/components/AssetHeader/hooks/useQuickBuy.ts:97-99
Timestamp: 2025-08-15T07:51:16.374Z
Learning: The selectPortfolioUserCurrencyBalanceByAssetId selector in src/state/slices/portfolioSlice/selectors.ts accepts a filter object with an assetId property (signature: (state, { assetId })), not a raw AssetId string. Passing a filter object like { assetId: someAssetId } is the correct usage pattern.

Applied to files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
📚 Learning: 2025-08-11T09:46:41.060Z
Learnt from: gomesalexandre
PR: shapeshift/web#10219
File: src/components/MultiHopTrade/components/TradeInput/TradeInput.tsx:167-172
Timestamp: 2025-08-11T09:46:41.060Z
Learning: In the shapeshift/web repository, the display cache logic for trade quotes (using `selectUserAvailableTradeQuotes` and `selectUserUnavailableTradeQuotes`) is intentionally kept the same between `TradeInput.tsx` and `TradeQuotes.tsx` components. The `hasQuotes` computation in `TradeInput.tsx` uses these display cache selectors by design, matching the pattern used in `TradeQuotes.tsx`.

Applied to files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
📚 Learning: 2025-09-02T00:02:44.889Z
Learnt from: premiumjibles
PR: shapeshift/web#10380
File: src/components/AssetSearch/components/GroupedAssetRow.tsx:116-0
Timestamp: 2025-09-02T00:02:44.889Z
Learning: premiumjibles prefers avoiding store.getState() calls in favor of useAppSelector where reactivity is needed, to prevent accidentally breaking reactive updates in components.

Applied to files:

  • src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx
🧬 Code graph analysis (1)
src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx (5)
src/components/Layout/Header/ActionCenter/ActionCenterContext.tsx (1)
  • useActionCenterContext (34-38)
src/hooks/useNotificationToast.tsx (1)
  • useNotificationToast (9-19)
src/state/slices/swapSlice/swapSlice.ts (1)
  • swapSlice (13-37)
src/state/slices/tradeInputSlice/tradeInputSlice.ts (1)
  • tradeInput (35-53)
src/components/Layout/Header/ActionCenter/components/Notifications/SwapNotification.tsx (1)
  • SwapNotification (24-122)
⏰ 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). (1)
  • GitHub Check: Install and Cache
🔇 Additional comments (8)
src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx (8)

19-19: Router import is appropriate.
Using useNavigate here makes sense for the post-signing redirect.


23-25: Action Center + notification imports look correct.
The dependencies align with the new notification-driven flow.


27-27: Good: unified toast hook.
useNotificationToast keeps position/responsiveness consistent across the app.


40-41: Selectors/actions import LGTM.
Pulling from swapSlice and tradeInput is consistent with existing patterns.


58-58: Navigate usage LGTM.
No concerns.


62-64: Toast lifetime tied to Action Center state is a nice touch.
Duration toggling when the drawer is open is user-friendly.


97-99: Active swap lookups LGTM.
Using selectActiveSwapId + selectSwapsById is the right combo for dedupe.


454-459: Deps list looks complete.
No additional deps required if the final-hop guard is applied (already depends on tradeQuote, toast, navigate, openActionCenter, activeSwapId, swapsById).

@gomesalexandre gomesalexandre enabled auto-merge (squash) September 2, 2025 21:31
@gomesalexandre gomesalexandre merged commit 10a351f into develop Sep 2, 2025
4 checks passed
@gomesalexandre gomesalexandre deleted the feat_swap_details_execution_price_2 branch September 2, 2025 21:39
@coderabbitai coderabbitai bot mentioned this pull request Oct 21, 2025
1 task
@coderabbitai coderabbitai bot mentioned this pull request Nov 12, 2025
11 tasks
@coderabbitai coderabbitai bot mentioned this pull request Nov 20, 2025
1 task
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.

Remove status screen of swapper in favor of notifications

3 participants