Skip to content

Commit

Permalink
refactor(web): move totalAppealingDisputes to useUser query
Browse files Browse the repository at this point in the history
  • Loading branch information
alcercu committed Sep 15, 2023
1 parent 41f261d commit 7a3ea07
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 36 deletions.
32 changes: 0 additions & 32 deletions web/src/hooks/queries/useMyCasesCounterQuery.ts

This file was deleted.

1 change: 1 addition & 0 deletions web/src/hooks/queries/useUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const userQuery = graphql(`
user(id: $address) {
totalDisputes
totalResolvedDisputes
totalAppealingDisputes
totalCoherent
tokens {
court {
Expand Down
5 changes: 1 addition & 4 deletions web/src/pages/Dashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import styled from "styled-components";
import { useAccount } from "wagmi";
import { DisputeDetailsFragment, useMyCasesQuery } from "queries/useCasesQuery";
import { useFiltersContext } from "context/FilterProvider";
import { useMyCasesCounterQuery } from "queries/useMyCasesCounterQuery";
import { useUserQuery, UserQuery } from "queries/useUser";
import { OrderDirection } from "src/graphql/graphql";
import JurorInfo from "./JurorInfo";
Expand Down Expand Up @@ -63,12 +62,10 @@ const Dashboard: React.FC = () => {
const disputeSkip = debouncedSearch ? 0 : 3 * (currentPage - 1);
const direction = timeFilter === 0 ? OrderDirection.Desc : OrderDirection.Asc;
const courtChoice = courtFilter === 0 ? {} : { court: courtFilter.toString() };
const { data: userAppealCases } = useMyCasesCounterQuery(address, { ...courtChoice });
const userAppealCasesNumber = userAppealCases?.user?.totalAppealingDisputes;
const queryFilters = { ...combinedQueryFilters, ...courtChoice };
const { data: disputesData } = useMyCasesQuery(address, disputeSkip, queryFilters, direction);
const { data: userData } = useUserQuery(address);
const totalPages = calculatePages(statusFilter, userData, casesPerPage, userAppealCasesNumber);
const totalPages = calculatePages(statusFilter, userData, casesPerPage, userData?.user?.totalAppealingDisputes);

useEffect(() => {
setCurrentPage(1);
Expand Down

0 comments on commit 7a3ea07

Please sign in to comment.