fix(Rewards): error when visiting rewards tab cp-7.76.0#29823
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. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
The changes are scoped entirely to the Rewards controller state management layer with defensive null-coalescing. E2E tests for Perps (SmokePerps), Predictions (SmokePredictions), or WalletPlatform (SmokeWalletPlatform) would not be meaningfully validated by these changes since the null-safety guards only activate when state fields are absent (which doesn't happen in normal E2E test flows). Running no E2E tags is appropriate here as the risk is low and the changes are purely internal defensive improvements covered by unit tests. Performance Test Selection: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d7b351d. Configure here.
|
Montoya
left a comment
There was a problem hiding this comment.
LGTM! Tested and confirmed no issues.




Description
https://consensyssoftware.atlassian.net/browse/RWDS-1267
The Rewards crash likely came from an older persisted Rewards Redux state that did not have newer array fields, especially campaigns. On affected devices, selectCampaigns could return undefined.
It was account/device dependent because persisted state differs per user/install.
Fix Applied: hardened both the restore path and selector path to fallback to initial state (empty array or object instead of undefined)
Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/RWDS-1267
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Low Risk
Low risk: changes are defensive fallbacks for missing/undefined persisted state and selector inputs, with added tests; behavior should only differ for legacy/partial states.
Overview
Prevents Rewards tab crashes caused by older/partial persisted Redux/controller state by defaulting missing fields to safe empty values.
Selectors and rehydrate logic now coalesce
undefinedarrays/objects (e.g.,campaigns, season arrays,benefits, dismissed-toasts map, controlleraccounts/subscriptions) to empty defaults, andRewardsControllerdefault state was extracted intodefaultState.tsand reused. Test coverage was expanded to lock in these upgrade/undefined-state behaviors.Reviewed by Cursor Bugbot for commit d7b351d. Bugbot is set up for automated code reviews on this repo. Configure here.