diff --git a/govtool/frontend/src/pages/DRepDirectoryContent.tsx b/govtool/frontend/src/pages/DRepDirectoryContent.tsx index 352ffc720..49a47be2f 100644 --- a/govtool/frontend/src/pages/DRepDirectoryContent.tsx +++ b/govtool/frontend/src/pages/DRepDirectoryContent.tsx @@ -58,6 +58,11 @@ export const DRepDirectoryContent: FC = ({ ); const myDrep = myDRepList?.[0]; + const { dRepData: yourselfDRepList } = useGetDRepListInfiniteQuery({ + searchPhrase: myDRepId, + }); + const yourselfDRep = yourselfDRepList?.[0]; + const { dRepData: dRepList, isPreviousData, @@ -84,6 +89,13 @@ export const DRepDirectoryContent: FC = ({ const ada = correctAdaFormat(votingPower); + const dRepsWithoutYourself = dRepList?.filter( + (dRep) => !isSameDRep(dRep, myDRepId), + ); + const dRepListToDisplay = yourselfDRep + ? [yourselfDRep, ...dRepsWithoutYourself] + : dRepList; + return ( {/* My delegation */} @@ -176,7 +188,7 @@ export const DRepDirectoryContent: FC = ({ )} - {dRepList?.map((dRep) => { + {dRepListToDisplay?.map((dRep) => { if (isSameDRep(dRep, myDrep?.view)) { return null; }