Skip to content

Conversation

@Matt561
Copy link
Contributor

@Matt561 Matt561 commented Jan 8, 2026

Description

Updated rendering conditions of mUSD conversion CTAs and added feature flags for each CTA.

Primary and Seconday CTA Rendering Conditions

Case Primary CTA (Top of Asset List) Visible? Secondary CTA (Token List Item) Visible?
New Wallet - no stables + no mUSD ✅ Display "Buy mUSD" variant
Popular networks filter selected - has stables + no mUSD ✅ Display "Get mUSD" variant
Single network selected - has stables + no mUSD ✅ Display "Get mUSD" variant
Popular networks filter selected - has mUSD on any network + has stables on any network
Single network selected - has mUSD on network + has stables on network
Has mUSD + has no stables

Feature flags added

  • Renamed selectIsMusdCtaEnabledFlag to selectIsMusdGetBuyCtaEnabledFlag
  • Added selectIsMusdConversionTokenListItemCtaEnabledFlag
  • Added selectIsMusdConversionAssetOverviewEnabledFlag
  • Added selectIsMusdConversionRewardsUiEnabledFlag

Changelog

CHANGELOG entry: refactored mUSD conversion CTA rendering conditions

Related issues

Fixes:

Manual testing steps

See rendering conditions table above.

Screenshots/Recordings

Before

Primary and Secondary CTAs could be rendered at the same time.

After

Primary or Secondary CTA rendered but never both at the same time.

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Consolidates and refines mUSD conversion CTA rendering across the app with explicit feature flags and shared visibility logic.

  • Introduces useMusdCtaVisibility (decides Buy/Get mUSD, token list item, and asset overview CTAs) and useMusdBalance (detects mUSD balances per chain)
  • Adds selectors/flags: selectIsMusdGetBuyCtaEnabledFlag, selectIsMusdConversionTokenListItemCtaEnabledFlag, selectIsMusdConversionAssetOverviewEnabledFlag, selectIsMusdConversionRewardsUiEnabledFlag, and selectMusdConversionCTATokens
  • Simplifies useMusdConversionTokens (removes CTA-specific checks; keeps filtering/support and output chain resolution)
  • Updates components to the new visibility API: MusdConversionAssetListCtashouldShowBuyGetMusdCta, TokenListItemshouldShowTokenListItemCta, EarnLendingBalanceshouldShowAssetOverviewCta
  • Extends .js.env.example with MM_MUSD_CTA_ENABLED, MM_MUSD_CONVERSION_ASSET_OVERVIEW_CTA, MM_MUSD_CONVERSION_TOKEN_LIST_ITEM_CTA, MM_MUSD_CONVERSION_REWARDS_UI_ENABLED
  • Overhauls tests to new interfaces/behavior and fixes minor testing ergonomics (e.g., act, testIDs)

Written by Cursor Bugbot for commit 1a41c05. This will update automatically on new commits. Configure here.

@Matt561 Matt561 added No QA Needed Apply this label when your PR does not need any QA effort. team-earn labels Jan 8, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@Matt561 Matt561 force-pushed the feat/musd-188-refactor-musd-conversion-cta-visibility branch from 6aa40ad to a2df8f0 Compare January 9, 2026 18:37
@Matt561 Matt561 marked this pull request as ready for review January 9, 2026 18:59
@Matt561 Matt561 requested review from a team as code owners January 9, 2026 18:59
…of-uat' into feat/musd-188-refactor-musd-conversion-cta-visibility
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

🔍 Smart E2E Test Selection

⏭️ Smart E2E selection skipped - base branch is not main (base: feat/musd-187-musd-conversion-design-adjustments-ahead-of-uat)

All E2E tests pre-selected.

View GitHub Actions results

}, [balancesPerChainId]);

const hasMusdBalanceOnChain = (chainId: Hex) =>
Boolean(balancesByChain[chainId]);
Copy link

Choose a reason for hiding this comment

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

Unmemoized function causes unnecessary callback recreations

Medium Severity

The hasMusdBalanceOnChain function is created inline without useCallback, producing a new function reference on every render. Since this function is included in the dependency arrays of shouldShowBuyGetMusdCta and shouldShowTokenListItemCta callbacks in useMusdCtaVisibility, those callbacks will be recreated on every render, defeating memoization. This can cause unnecessary re-renders in consuming components, particularly impactful in the token list which may display many items.

Additional Locations (1)

Fix in Cursor Fix in Web

describe('hook structure', () => {
it('returns object with hasMusdBalance and balancesByChain properties', () => {
const { result } = renderHook(() => useHasMusdBalance());
it('returns object with hasMusdBalanceOnAnyChainOnAnyChain and balancesByChain properties', () => {
Copy link

Choose a reason for hiding this comment

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

Test names contain repeated word typo (Bugbot Rules)

Low Severity

Test names contain hasMusdBalanceOnAnyChainOnAnyChain with duplicated text instead of hasMusdBalanceOnAnyChain. This violates the unit testing guidelines rule that test names must be "specific about the behavior being tested" - the typo makes the test descriptions confusing and inaccurate as documentation.

Additional Locations (1)

Fix in Cursor Fix in Web

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 9, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No QA Needed Apply this label when your PR does not need any QA effort. size-XL team-earn

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants