From 7826b55bd786c5d0596dd9288936ccd3beca850d Mon Sep 17 00:00:00 2001 From: Joanna Dyczka Date: Wed, 2 Oct 2024 09:37:16 +0200 Subject: [PATCH] [#2090] fix infinite loading in DRep Directory --- CHANGELOG.md | 1 + .../frontend/src/hooks/queries/useGetDRepListQuery.ts | 10 +++++----- govtool/frontend/src/pages/DRepDirectoryContent.tsx | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df11b06eb..5b2fbdb22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ changes. - Add missing testIds for submitted votes [Issue 1875](https://github.com/IntersectMBO/govtool/issues/1875) - Provide workaround for iOS for downloading metadata on iOS [Issue 1989](https://github.com/IntersectMBO/govtool/issues/1989) +- Fix infinite loading in DRep Directory [Issue 2090](https://github.com/IntersectMBO/govtool/issues/2090) ### Changed diff --git a/govtool/frontend/src/hooks/queries/useGetDRepListQuery.ts b/govtool/frontend/src/hooks/queries/useGetDRepListQuery.ts index 3eb2a956f..562eb4930 100644 --- a/govtool/frontend/src/hooks/queries/useGetDRepListQuery.ts +++ b/govtool/frontend/src/hooks/queries/useGetDRepListQuery.ts @@ -33,11 +33,11 @@ export const useGetDRepListInfiniteQuery = ( pendingTransaction.registerAsDrep || pendingTransaction.retireAsDirectVoter || pendingTransaction.retireAsDrep - )?.transactionHash, - filters, - searchPhrase, - sorting, - status, + )?.transactionHash ?? 'noPendingTransaction', + filters.length ? filters : "", + searchPhrase ?? "", + sorting ?? "", + status?.length ? status : "", ], async ({ pageParam = 0 }) => getDRepList({ diff --git a/govtool/frontend/src/pages/DRepDirectoryContent.tsx b/govtool/frontend/src/pages/DRepDirectoryContent.tsx index 3ac416951..c86b90744 100644 --- a/govtool/frontend/src/pages/DRepDirectoryContent.tsx +++ b/govtool/frontend/src/pages/DRepDirectoryContent.tsx @@ -48,8 +48,8 @@ export const DRepDirectoryContent: FC = ({ dataActionsBarProps; useEffect(() => { - setChosenSorting(DRepListSort.Random); - }, [setChosenSorting]); + if (!chosenSorting) setChosenSorting(DRepListSort.Random); + }, [chosenSorting, setChosenSorting]); const { delegate, isDelegating } = useDelegateTodRep();