Skip to content

Commit 1e8f3c4

Browse files
authored
fix: LM Vesting crashes rewards page (#972)
1 parent ab30a5a commit 1e8f3c4

4 files changed

Lines changed: 31 additions & 3 deletions

File tree

.changeset/modern-ducks-shake.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'frontend': patch
3+
---
4+
5+
fix: LM Vesting crashes rewards page

apps/frontend/src/app/5_pages/RewardsPage/RewardsPage.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { FC, useEffect, useMemo, useState } from 'react';
33
import { t } from 'i18next';
44
import { Helmet } from 'react-helmet-async';
55
import { Trans } from 'react-i18next';
6-
import { useNavigate } from 'react-router-dom';
6+
import { useNavigate, useSearchParams } from 'react-router-dom';
77

88
import {
99
SelectOption,
@@ -38,6 +38,8 @@ import { Vesting } from './components/Vesting/Vesting';
3838
const ACTIVE_CLASSNAME = 'border-t-primary-30';
3939

4040
const RewardsPage: FC = () => {
41+
const [params] = useSearchParams({ tab: '' });
42+
const tab = params.get('tab');
4143
const navigate = useNavigate();
4244
const { checkMaintenance, States } = useMaintenance();
4345
const rewardsLocked = checkMaintenance(States.REWARDS_FULL);
@@ -109,6 +111,25 @@ const RewardsPage: FC = () => {
109111
}
110112
}, [items, index]);
111113

114+
useEffect(() => {
115+
switch (tab) {
116+
case 'liquidityMining':
117+
setIndex(0);
118+
break;
119+
case 'stabilityPool':
120+
setIndex(1);
121+
break;
122+
case 'staking':
123+
setIndex(2);
124+
break;
125+
case 'vesting':
126+
setIndex(3);
127+
break;
128+
default:
129+
break;
130+
}
131+
}, [tab]);
132+
112133
return (
113134
<>
114135
<Helmet>

apps/frontend/src/app/5_pages/RewardsPage/components/Vesting/components/UnclaimedVestingAlert/UnclaimedVestingAlert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const UnclaimcedVestingAlert = () => {
2121
<Paragraph>
2222
{t(translations.unclaimedVestings.text, { value: count })}{' '}
2323
<Link
24-
to="/rewards"
24+
to="/rewards?tab=vesting"
2525
className="underline text-primary-20 hover:text-primary-10"
2626
>
2727
{t(translations.unclaimedVestings.cta)}

apps/frontend/src/app/5_pages/RewardsPage/components/Vesting/components/UnlockSchedule/UnlockSchedule.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ export const UnlockSchedule = (item: VestingContractTableRecord) => {
2020
);
2121

2222
useEffect(() => {
23-
update(state => (state.item = item));
23+
update(state => {
24+
state.item = item;
25+
});
2426
}, [item, update]);
2527

2628
return (

0 commit comments

Comments
 (0)