fix: enhance useMerklBonusClaim with session lock and reward refetching cp-7.72.0#28147
Conversation
|
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. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
app/components/UI/Earn/components/MerklRewards/hooks/useMerklBonusClaim.ts
Outdated
Show resolved
Hide resolved
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Risk Assessment: LOW - These are isolated changes to the Earn/Cash mUSD feature. The Homepage change is purely additive (adding CashSection to the refresh cycle). No shared navigation, modal, or confirmation infrastructure is modified. Tag Selection Rationale:
No E2E tests directly cover Merkl rewards or mUSD claim flows, so the selected tags provide the best available coverage for the affected areas (Homepage, wallet platform, staking/earn flows). Performance Test Selection: |
|
|
✅ E2E Fixture Validation — Schema is up to date |




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
Pre-merge reviewer checklist
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 CTA after a successful claim submission and only re-enables it after rewards data has refreshed (via a newrewardsFetchVersion).Enhances
useMerklRewardswith auto-refresh (60s), arewardsFetchVersioncounter, and clearing of staleclaimableRewardwhen a refetch returns no matching reward; the Homepage now wiresCashSectioninto 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.