From c5b0e3b0cf2ebcb11ee7a2d4879026e2f27707d5 Mon Sep 17 00:00:00 2001 From: "Shiv Bhonde | shivbhonde.eth" Date: Mon, 6 Jan 2025 16:19:45 +0530 Subject: [PATCH] update queries inline with new ponder update (#5) --- packages/nextjs/hooks/useCohortAddBuilderEvents.ts | 6 ++++-- packages/nextjs/hooks/useCohortWithdrawEvents.ts | 14 ++++++++------ packages/nextjs/pages/members.tsx | 10 +++++++--- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/packages/nextjs/hooks/useCohortAddBuilderEvents.ts b/packages/nextjs/hooks/useCohortAddBuilderEvents.ts index e97910e..18c3e35 100644 --- a/packages/nextjs/hooks/useCohortAddBuilderEvents.ts +++ b/packages/nextjs/hooks/useCohortAddBuilderEvents.ts @@ -4,7 +4,9 @@ import contracts from "~~/generated/hardhat_contracts"; const BuildersQuery = gql` query Builders($cohortAddress: String!) { cohortBuilders(where: { cohortContractAddress: $cohortAddress }, orderBy: "timestamp", orderDirection: "desc") { - id + items { + id + } } } `; @@ -17,6 +19,6 @@ export const useAddBuilderEvents = () => { }, }); - const data = addBuilderEventsData?.cohortBuilders || []; + const data = addBuilderEventsData?.cohortBuilders.items || []; return { data, isLoading }; }; diff --git a/packages/nextjs/hooks/useCohortWithdrawEvents.ts b/packages/nextjs/hooks/useCohortWithdrawEvents.ts index c4da8e0..be01acf 100644 --- a/packages/nextjs/hooks/useCohortWithdrawEvents.ts +++ b/packages/nextjs/hooks/useCohortWithdrawEvents.ts @@ -4,11 +4,13 @@ import contracts from "~~/generated/hardhat_contracts"; const WithdrawalsQuery = gql` query Withdrawls($cohortAddress: String!) { cohortWithdrawals(where: { cohortContractAddress: $cohortAddress }, orderBy: "timestamp", orderDirection: "desc") { - reason - builder - amount - timestamp - id + items { + reason + builder + amount + timestamp + id + } } } `; @@ -21,7 +23,7 @@ export const useCohortWithdrawEvents = () => { }, }); - const newContractWithdrawEvents = newWithdrawEventsData?.cohortWithdrawals || []; + const newContractWithdrawEvents = newWithdrawEventsData?.cohortWithdrawals.items || []; const data = [...newContractWithdrawEvents]; diff --git a/packages/nextjs/pages/members.tsx b/packages/nextjs/pages/members.tsx index dc3937a..fd4bf94 100644 --- a/packages/nextjs/pages/members.tsx +++ b/packages/nextjs/pages/members.tsx @@ -40,10 +40,14 @@ const Members: NextPage = () => { useEffect(() => { if (selectedAddress) { - setFilteredEvents(allWithdrawEvents?.filter((event: any) => event.builder === selectedAddress) || []); + setFilteredEvents( + allWithdrawEvents?.filter((event: any) => { + return event.builder.toLowerCase() === selectedAddress.toLowerCase(); + }) || [], + ); } - }, [selectedAddress, allWithdrawEvents]); - + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [selectedAddress]); return ( <>