Conversation
WalkthroughPreserves and stabilizes selected gasless fee asset by introducing an Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant UI as SendModalTokensTabView
participant Paymaster as PaymasterContext
User->>UI: Switch selected asset (Gasless mode)
UI->>UI: Build fee options for new asset (each with `id`)
alt Option with matching selectedFeeAsset.id exists
UI->>UI: Rehydrate selectedFeeAsset (id, token, decimals, price, balance)
UI->>Paymaster: Sync paymasterContext / address for preserved selection
UI-->>User: Keep previous fee selection
else No matching id
UI->>UI: Select first gasless fee option and set its id
UI->>Paymaster: Sync paymasterContext / address for new selection
UI-->>User: Update fee selection to default
end
Note over UI,Paymaster: Payload-driven flows store/propagate option `id` to preserve identity across steps
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
⏰ 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)
🔇 Additional comments (9)
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. 🧪 Early access (Sonnet 4.5): enabledWe are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience. Note:
Comment |
Deploying x with
|
| Latest commit: |
87be59f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1570ff4e.x-e62.pages.dev |
| Branch Preview URL: | https://pro-3735-gasless-fixes.x-e62.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (1)
330-351: Preserves user's fee token selection correctly.The logic successfully addresses the PR objective by:
- Detecting when a fee asset was previously selected by the user
- Searching for a matching option in the new asset's available fee options
- Restoring the selection if found, otherwise falling back to the first option
The case-insensitive contract address matching is appropriate.
Optional enhancement: Consider chain-specific validation.
If assets can be switched across different chains, you might want to verify that the matched fee asset is valid for the current chain:
const userSelectedOption = feeOptions.find(value => value.asset.contract.toLowerCase() === selectedFeeAsset.token.toLowerCase()); - if (userSelectedOption) { + if (userSelectedOption && userSelectedOption.chainId === selectedAsset.chainId) { // Keep user's selected fee assetThis prevents attempting to use a fee asset from a different chain.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx(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). (2)
- GitHub Check: lint
- GitHub Check: unit-tests
🔇 Additional comments (4)
src/components/BottomMenuModal/SendModal/SendModalTokensTabView.tsx (4)
162-168: LGTM: id field added to track fee asset identity.The addition of the
idfield toselectedFeeAssetenables precise matching and restoration of user's fee token selection across asset switches.
352-358: LGTM: Consistent id propagation for default selection.The
idfield is correctly populated when falling back to the first fee option, ensuring consistency across both user-driven and default selections.
2184-2197: LGTM: Captures id when user changes fee asset selection.The
idfield is correctly populated when the user explicitly selects a different fee asset, enabling preservation of this choice across subsequent asset switches.
2313-2313: LGTM: Applies preserved fee asset id to UI selection.The
defaultSelectedIdnow correctly uses the preservedselectedFeeAsset?.id, ensuring the user's fee token choice is reflected in the dropdown after asset switches. The fallback tofeeAssetOptions[0]?.idmaintains safe default behavior.
|
@vignesha22 can we also turn off portolio refresh on focus? |
Description
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Summary by CodeRabbit
New Features
Bug Fixes
Chores