Skip to content

Commit

Permalink
fix: query update based on subgraph changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nhestrompia committed Sep 15, 2023
1 parent 504d5d7 commit 41f261d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions web/src/hooks/queries/useMyCasesCounterQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type { MyCasesCounterQuery };
const myCasesCounter = graphql(`
query MyCasesCounter($id: ID!, $where: Dispute_filter) {
user(id: $id) {
totalAppealingDisputes
disputes(orderBy: lastPeriodChange, where: $where) {
id
}
Expand Down
6 changes: 3 additions & 3 deletions web/src/pages/Dashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { DisputeDetailsFragment, useMyCasesQuery } from "queries/useCasesQuery";
import { useFiltersContext } from "context/FilterProvider";
import { useMyCasesCounterQuery } from "queries/useMyCasesCounterQuery";
import { useUserQuery, UserQuery } from "queries/useUser";
import { OrderDirection, Period } from "src/graphql/graphql";
import { OrderDirection } from "src/graphql/graphql";
import JurorInfo from "./JurorInfo";
import Courts from "./Courts";
import CasesDisplay from "components/CasesDisplay";
Expand Down Expand Up @@ -63,8 +63,8 @@ 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, { period: Period.Appeal, ...courtChoice });
const userAppealCasesNumber = userAppealCases?.user?.disputes.length;
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);
Expand Down

0 comments on commit 41f261d

Please sign in to comment.