Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/modern-ducks-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'frontend': patch
---

fix: LM Vesting crashes rewards page
23 changes: 22 additions & 1 deletion apps/frontend/src/app/5_pages/RewardsPage/RewardsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { FC, useEffect, useMemo, useState } from 'react';
import { t } from 'i18next';
import { Helmet } from 'react-helmet-async';
import { Trans } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import { useNavigate, useSearchParams } from 'react-router-dom';

import {
SelectOption,
Expand Down Expand Up @@ -38,6 +38,8 @@ import { Vesting } from './components/Vesting/Vesting';
const ACTIVE_CLASSNAME = 'border-t-primary-30';

const RewardsPage: FC = () => {
const [params] = useSearchParams({ tab: '' });
const tab = params.get('tab');
const navigate = useNavigate();
const { checkMaintenance, States } = useMaintenance();
const rewardsLocked = checkMaintenance(States.REWARDS_FULL);
Expand Down Expand Up @@ -109,6 +111,25 @@ const RewardsPage: FC = () => {
}
}, [items, index]);

useEffect(() => {
switch (tab) {
case 'liquidityMining':
setIndex(0);
break;
case 'stabilityPool':
setIndex(1);
break;
case 'staking':
setIndex(2);
break;
case 'vesting':
setIndex(3);
break;
default:
break;
}
}, [tab]);

return (
<>
<Helmet>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const UnclaimcedVestingAlert = () => {
<Paragraph>
{t(translations.unclaimedVestings.text, { value: count })}{' '}
<Link
to="/rewards"
to="/rewards?tab=vesting"
className="underline text-primary-20 hover:text-primary-10"
>
{t(translations.unclaimedVestings.cta)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export const UnlockSchedule = (item: VestingContractTableRecord) => {
);

useEffect(() => {
update(state => (state.item = item));
update(state => {
state.item = item;
});
}, [item, update]);

return (
Expand Down