Skip to content

chore(runway): cherry-pick fix: enhance useMerklBonusClaim with session lock and reward refetching#28204

Merged
chloeYue merged 1 commit into
release/7.72.0from
cherry-pick-7-72-0-bf586c0
Apr 1, 2026
Merged

chore(runway): cherry-pick fix: enhance useMerklBonusClaim with session lock and reward refetching#28204
chloeYue merged 1 commit into
release/7.72.0from
cherry-pick-7-72-0-bf586c0

Conversation

@runway-github

@runway-github runway-github Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes a regression where the Claim bonus CTA for mUSD could remain
visible after a successful claim and allow reopening claim flow with
effectively no claimable value.

The solution introduces a post-claim lock in useMerklBonusClaim, then
unlocks that CTA after reward data is refreshed (manual pull-to-refresh,
section refresh/remount, or periodic auto-refresh). It also fixes stale
reward state handling so old claimable values are cleared when reward
fetch returns no matching reward.

Changelog

CHANGELOG entry: Fixed an issue where the mUSD Claim bonus button could
remain visible after claiming and trigger another claim flow.

Related issues

Fixes: #28135

Manual testing steps

Feature: mUSD claim bonus CTA state lifecycle

  Scenario: CTA hides after successful claim and reappears after refresh when claimable again
    Given user has claimable mUSD bonus
    And user is on Homepage with Cash section visible
    When user taps "Claim bonus" and confirms the transaction
    Then loader is shown briefly
    And "Claim bonus" is hidden after successful submission

    When user pulls to refresh Homepage
    Then Cash section refreshes
    And claim bonus eligibility is re-evaluated

    When sufficient time passes for auto-refresh interval
    Then claim bonus eligibility is re-evaluated automatically

  Scenario: stale claimable state is cleared
    Given previous claimable reward was shown
    When rewards fetch returns no matching reward
    Then "Claim bonus" is not shown

Screenshots/Recordings

Before

After

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

Medium Risk
Touches claim CTA gating and introduces a periodic fetch interval;
incorrect locking/versioning could hide the CTA or increase background
network activity unexpectedly.

Overview
Fixes the mUSD Merkl “Claim bonus” CTA lifecycle by adding a
post-claim session lock in useMerklBonusClaim that hides the CTA
after a successful claim submission and only re-enables it after rewards
data has refreshed (via a new rewardsFetchVersion).

Enhances useMerklRewards with auto-refresh (60s), a
rewardsFetchVersion counter, and clearing of stale claimableReward
when a refetch returns no matching reward; the Homepage now wires
CashSection into the global refresh flow and exposes a section
refresh() that forces a remount of the cash row to reset claim state.
Tests were updated/added to cover the lock/unlock behavior, stale
clearing, interval cleanup, version increments, and cash row remount on
refresh.

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

[bf586c0](https://github.com/MetaMask/metamask-mobile/commit/bf586c0001567423eabe45d1d156443ab33c53f1)

…ng cp-7.72.0 (#28147)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

Fixes a regression where the Claim bonus CTA for mUSD could remain
visible after a successful claim and allow reopening claim flow with
effectively no claimable value.

The solution introduces a post-claim lock in useMerklBonusClaim, then
unlocks that CTA after reward data is refreshed (manual pull-to-refresh,
section refresh/remount, or periodic auto-refresh). It also fixes stale
reward state handling so old claimable values are cleared when reward
fetch returns no matching reward.

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: Fixed an issue where the mUSD Claim bonus button could
remain visible after claiming and trigger another claim flow.

Fixes: #28135

```gherkin
Feature: mUSD claim bonus CTA state lifecycle

  Scenario: CTA hides after successful claim and reappears after refresh when claimable again
    Given user has claimable mUSD bonus
    And user is on Homepage with Cash section visible
    When user taps "Claim bonus" and confirms the transaction
    Then loader is shown briefly
    And "Claim bonus" is hidden after successful submission

    When user pulls to refresh Homepage
    Then Cash section refreshes
    And claim bonus eligibility is re-evaluated

    When sufficient time passes for auto-refresh interval
    Then claim bonus eligibility is re-evaluated automatically

  Scenario: stale claimable state is cleared
    Given previous claimable reward was shown
    When rewards fetch returns no matching reward
    Then "Claim bonus" is not shown
```

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

<!-- [screenshots/recordings] -->

<!-- [screenshots/recordings] -->

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

- [ ] 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.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Touches claim CTA gating and introduces a periodic fetch interval;
incorrect locking/versioning could hide the CTA or increase background
network activity unexpectedly.
>
> **Overview**
> Fixes the mUSD Merkl “Claim bonus” CTA lifecycle by adding a
**post-claim session lock** in `useMerklBonusClaim` that hides the CTA
after a successful claim submission and only re-enables it after rewards
data has refreshed (via a new `rewardsFetchVersion`).
>
> Enhances `useMerklRewards` with **auto-refresh (60s)**, a
`rewardsFetchVersion` counter, and clearing of stale `claimableReward`
when a refetch returns no matching reward; the Homepage now wires
`CashSection` into the global refresh flow and exposes a section
`refresh()` that forces a remount of the cash row to reset claim state.
Tests were updated/added to cover the lock/unlock behavior, stale
clearing, interval cleanup, version increments, and cash row remount on
refresh.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
67ccc05. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@runway-github runway-github Bot requested a review from a team as a code owner March 31, 2026 20:33
@github-actions

Copy link
Copy Markdown
Contributor

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.

@metamaskbot metamaskbot added the team-bots Bot team (for MetaMask Bot, Runway Bot, etc.) label Mar 31, 2026
@github-actions github-actions Bot added size-M risk-low Low testing needed · Low bug introduction risk labels Mar 31, 2026
@chloeYue chloeYue added the skip-smart-e2e-selection Skip Smart E2E selection, i.e. select all E2E tests to run label Apr 1, 2026
@github-actions github-actions Bot added risk-high Extensive testing required · High bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Apr 1, 2026
@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

⏭️ Smart E2E selection skipped - skip-smart-e2e-selection label found

All E2E tests pre-selected.

View GitHub Actions results

@chloeYue chloeYue left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
18 value mismatches detected (expected — fixture represents an existing user).
View details

@sonarqubecloud

sonarqubecloud Bot commented Apr 1, 2026

Copy link
Copy Markdown

@chloeYue

chloeYue commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

Bypass audit error @xmldom/xmldom to force merge this cherry-pick, as the audit error will be fixed by another PR

@chloeYue chloeYue enabled auto-merge (squash) April 1, 2026 08:11
@chloeYue chloeYue disabled auto-merge April 1, 2026 08:11
@chloeYue chloeYue merged commit b7c140a into release/7.72.0 Apr 1, 2026
196 of 204 checks passed
@chloeYue chloeYue deleted the cherry-pick-7-72-0-bf586c0 branch April 1, 2026 08:11
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

risk-high Extensive testing required · High bug introduction risk size-M skip-smart-e2e-selection Skip Smart E2E selection, i.e. select all E2E tests to run team-bots Bot team (for MetaMask Bot, Runway Bot, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants