Skip to content

Commit 049b910

Browse files
committed
Fix bug
1 parent 29df849 commit 049b910

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

app/components/UI/Rewards/components/Tabs/ActivityTab/ActivityTab.test.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,5 +1008,19 @@ describe('ActivityTab', () => {
10081008
'SWAP',
10091009
);
10101010
});
1011+
1012+
it('handles undefined seasonActivityTypes gracefully (upgrade scenario)', () => {
1013+
// Simulate upgrade scenario where seasonActivityTypes is undefined from persisted state
1014+
mockSelectSeasonActivityTypes.mockReturnValueOnce(
1015+
undefined as unknown as typeof mockSeasonActivityTypes,
1016+
);
1017+
1018+
const { getByTestId, getByText } = render(<ActivityTab />);
1019+
1020+
// Should render without crashing and show only the "All" option
1021+
expect(getByTestId('select-option-sheet')).toBeOnTheScreen();
1022+
expect(getByText('All')).toBeOnTheScreen();
1023+
expect(getByTestId('activity-filter-ALL')).toBeOnTheScreen();
1024+
});
10111025
});
10121026
});

app/components/UI/Rewards/components/Tabs/ActivityTab/ActivityTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const ActivityFilter: React.FC<ActivityFilterProps> = ({
5555
label: strings('rewards.filter_all'),
5656
};
5757

58-
const activityOptions: ISelectOption[] = seasonActivityTypes.map(
58+
const activityOptions: ISelectOption[] = (seasonActivityTypes ?? []).map(
5959
(activityType) => ({
6060
key: activityType.type.toLowerCase(),
6161
value: activityType.type,

0 commit comments

Comments
 (0)