chore(runway): cherry-pick fix: enhance useMerklBonusClaim with session lock and reward refetching#28204
Merged
Merged
Conversation
…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 -->
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. |
nickewansmith
approved these changes
Mar 31, 2026
Contributor
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - skip-smart-e2e-selection label found All E2E tests pre-selected. |
Contributor
|
✅ E2E Fixture Validation — Schema is up to date |
|
Contributor
|
Bypass audit error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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
Screenshots/Recordings
Before
After
Pre-merge author checklist
Docs and MetaMask Mobile
Coding
Standards.
if applicable
guidelines).
Not required for external contributors.
Pre-merge reviewer checklist
app, test code being changed).
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
useMerklBonusClaimthat hides the CTAafter a successful claim submission and only re-enables it after rewards
data has refreshed (via a new
rewardsFetchVersion).Enhances
useMerklRewardswith auto-refresh (60s), arewardsFetchVersioncounter, and clearing of staleclaimableRewardwhen a refetch returns no matching reward; the Homepage now wires
CashSectioninto the global refresh flow and exposes a sectionrefresh()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.