Skip to content

Commit 065e726

Browse files
committed
Fix: Sorting functionality for active and ended farms on Dogechain
1 parent a346363 commit 065e726

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/pages/FarmPage/V3/AllV3Farms.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useMemo, useState } from 'react';
1+
import React, { useEffect, useMemo, useState } from 'react';
22
import { Box, useMediaQuery, useTheme } from '@material-ui/core';
33
import { useTranslation } from 'react-i18next';
44
import CustomTabSwitch from 'components/v3/CustomTabSwitch';
@@ -34,6 +34,7 @@ import { getConfig } from 'config/index';
3434
interface Props {
3535
searchValue: string;
3636
farmStatus: string;
37+
sortValue: string;
3738
}
3839

3940
export interface V3FarmPair {
@@ -46,7 +47,11 @@ export interface V3FarmPair {
4647
farms: V3Farm[];
4748
}
4849

49-
const AllV3Farms: React.FC<Props> = ({ searchValue, farmStatus }) => {
50+
const AllV3Farms: React.FC<Props> = ({
51+
searchValue,
52+
farmStatus,
53+
sortValue,
54+
}) => {
5055
const { t } = useTranslation();
5156
const { breakpoints } = useTheme();
5257
const { chainId } = useActiveWeb3React();
@@ -127,6 +132,10 @@ const AllV3Farms: React.FC<Props> = ({ searchValue, farmStatus }) => {
127132
};
128133
});
129134

135+
useEffect(() => {
136+
setSortBy(sortValue);
137+
}, [sortValue]);
138+
130139
const {
131140
data: allEternalFarms,
132141
isLoading: eternalFarmsLoading,

src/pages/FarmPage/V3/Farms.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,11 @@ export default function Farms() {
284284
sortValue={selectedSort}
285285
/>
286286
) : (
287-
<AllV3Farms searchValue={searchValue} farmStatus={farmStatus} />
287+
<AllV3Farms
288+
searchValue={searchValue}
289+
farmStatus={farmStatus}
290+
sortValue={selectedSort}
291+
/>
288292
))}
289293
{selectedFarmCategory.id === 2 && (
290294
<FarmingMyFarms search={searchValue} chainId={chainIdToUse} />

0 commit comments

Comments
 (0)