Skip to content

Comments

sending transaction speed improvements#262

Merged
RanaBug merged 1 commit intostagingfrom
fix/wallet-connect-qa-fixes
Mar 20, 2025
Merged

sending transaction speed improvements#262
RanaBug merged 1 commit intostagingfrom
fix/wallet-connect-qa-fixes

Conversation

@RanaBug
Copy link
Collaborator

@RanaBug RanaBug commented Mar 20, 2025

Description

  • Removed balances query for tokens and nfts when a transaction is sending
  • Remove double estimation of transaction

How Has This Been Tested?

  • Existing Unit Tests and Manual Testing

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
    • Improved the transaction views to deliver real-time updates for account balances and digital assets.
    • Streamlined the data refresh logic to ensure a more responsive interface when processing transfers and navigating between tabs.

@RanaBug RanaBug requested a review from IAmKio March 20, 2025 10:03
@RanaBug RanaBug self-assigned this Mar 20, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 20, 2025

Walkthrough

This PR updates the transaction handling in the SendModal components by integrating AccountBalancesContext and AccountNftsContext via the useContext hook. Both the SendModalBatchesTabView and SendModalTokensTabView components now use a useEffect hook to toggle context data update flags based on the transaction sending state. Additionally, the token view replaces the estimation logic with a sending mechanism, while the BottomMenuModal now updates context data only when the Account tab is active.

Changes

File(s) Change Summary
src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx
src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx
Integrated AccountBalancesContext and AccountNftsContext using useContext; added useEffect hooks to manage updates based on transaction state. The Tokens view additionally replaces the estimate call with the send method and revises related logging.
src/components/BottomMenuModal/index.tsx Revised logic for updating NFT/token balance data based on the active tab. Data updates now occur only when the active tab (activeIndex 2) is selected, with updates halted for other views.

Sequence Diagram(s)

sequenceDiagram
    participant Component
    participant Context (Balances & NFTs)
    Note over Component: On component render and transaction action
    Component->>Component: Evaluate sending state (anyChainSending / isSending)
    alt Transaction in progress
        Component->>Context: Set update flag to false
    else
        Component->>Context: Set update flag to true
    end
Loading
sequenceDiagram
    participant BottomMenuModal
    participant ContextUpdater
    BottomMenuModal->>BottomMenuModal: Check activeIndex value
    alt activeIndex == 2 (Account)
        BottomMenuModal->>ContextUpdater: Trigger NFT/token update
    else activeIndex == 1, 3, or null
        BottomMenuModal->>ContextUpdater: Halt updates
    end
Loading

Possibly related PRs

Suggested reviewers

  • IAmKio

Poem

I'm a hopping rabbit in the code forest,
Skipping along with context at my side,
Transactions and tokens dance in earnest,
Updates align like a perfect bunny stride,
Celebrating changes with a joyful, digital glide! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fffba9f and 4fdba23.

⛔ Files ignored due to path filters (2)
  • src/apps/pillarx-app/components/MediaGridCollection/tests/__snapshots__/DisplayCollectionImage.test.tsx.snap is excluded by !**/*.snap
  • src/apps/pillarx-app/components/PointsTile/test/__snapshots__/PointsTile.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (3)
  • src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx (4 hunks)
  • src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (6 hunks)
  • src/components/BottomMenuModal/index.tsx (1 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (2)
src/providers/AccountNftsProvider.tsx (1) (1)
  • AccountNftsContext (47-49)
src/providers/AccountBalancesProvider.tsx (1) (1)
  • AccountBalancesContext (47-48)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: unit-tests
  • GitHub Check: build
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (10)
src/components/BottomMenuModal/index.tsx (2)

33-37: Improved tab-specific data update logic

The changes to only update NFTs and token balances when the Account tab is open (index 2) rather than also on the Send tab (index 0) aligns well with the PR objectives of improving transaction speed.


39-43: Clearer condition for stopping data updates

The updated condition explicitly states when to stop updating (History tab, Apps tab, or no tab open), making the code more maintainable and easier to understand.

src/components/BottomMenuModal/SendModal/SendModalBatchesTabView.tsx (3)

57-58: Good addition of context hooks

Adding context access for NFTs and balances allows for more efficient data management during batch transactions.


72-73: Improved variable placement

Moving the anyChainSending variable definition earlier in the file makes the code more organized, as it's now defined before being used in the useEffect hook.


74-84: Optimized data update strategy during transactions

This useEffect hook intelligently toggles data updates based on transaction status, preventing unnecessary data fetching during active transactions and resuming updates when transactions complete.

This change directly contributes to the PR objective of improving transaction sending speed by reducing background data operations during the transaction process.

src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (5)

103-104: Added context hooks for efficient data management

Adding context access for NFTs and balances is consistent with the changes in the Batches view, promoting a unified approach to data management.


113-123: Optimized data update strategy during transactions

Similar to the batch view, this useEffect hook intelligently manages data updates based on transaction status, preventing unnecessary background operations during sending.

This change helps achieve the PR objective of improving transaction sending speed.


232-233: Eliminated redundant estimation step

Replacing the separate estimate call with a direct send call eliminates the double estimation issue mentioned in the PR objectives. Since the send function already includes estimation data, this change streamlines the transaction process while still providing necessary cost information.


234-250: Updated variable references to match new transaction flow

The code correctly updates all references from estimated to sent throughout the transaction handling logic, ensuring consistency with the new streamlined approach.


252-254: Consistent error handling with new transaction flow

Error handling has been properly updated to extract error messages from the sent response rather than the estimated response.

✨ 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
🪧 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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai 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

Documentation and Community

  • 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.

@cloudflare-workers-and-pages
Copy link

Deploying x with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4fdba23
Status: ✅  Deploy successful!
Preview URL: https://fa43b7f7.x-e62.pages.dev
Branch Preview URL: https://fix-wallet-connect-qa-fixes.x-e62.pages.dev

View logs

Copy link
Collaborator

@IAmKio IAmKio left a comment

Choose a reason for hiding this comment

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

LGTM

@RanaBug RanaBug merged commit 41d0f3a into staging Mar 20, 2025
7 checks passed
@coderabbitai coderabbitai bot mentioned this pull request May 23, 2025
3 tasks
This was referenced Jun 23, 2025
@coderabbitai coderabbitai bot mentioned this pull request Jul 1, 2025
3 tasks
@coderabbitai coderabbitai bot mentioned this pull request Sep 8, 2025
3 tasks
@coderabbitai coderabbitai bot mentioned this pull request Oct 30, 2025
3 tasks
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