Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix chainid bug in refetch #1817

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions web-devtools/src/hooks/queries/useDisputeTemplateFromId.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@tanstack/react-query";

import { useGraphqlBatcher } from "context/GraphqlBatcher";
import { DEFAULT_CHAIN } from "consts/chains";
import { isUndefined } from "utils/isUndefined";

import { graphql } from "src/graphql-generated";
Expand Down Expand Up @@ -29,6 +30,7 @@ export const useDisputeTemplateFromId = (templateId?: string) => {
await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: disputeTemplateQuery,
chainId: DEFAULT_CHAIN,
variables: { id: templateId?.toString() },
isDisputeTemplate: true,
}),
Expand Down
2 changes: 2 additions & 0 deletions web/src/components/ErrorFallback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const ErrorContainer = styled.div`
flex-direction: column;
justify-content: center;
align-items: center;

${landscapeStyle(
() => css`
flex-direction: row;
Expand All @@ -42,6 +43,7 @@ const InfoWrapper = styled.div`
gap: 32px;
align-items: center;
flex: 1;

${landscapeStyle(
() => css`
align-items: start;
Expand Down
8 changes: 7 additions & 1 deletion web/src/hooks/queries/useAllCasesQuery.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@tanstack/react-query";

import { useGraphqlBatcher } from "context/GraphqlBatcher";
import { DEFAULT_CHAIN } from "consts/chains";

import { graphql } from "src/graphql";
import { AllCasesQuery } from "src/graphql/graphql";
Expand All @@ -21,6 +22,11 @@ export const useAllCasesQuery = () => {
return useQuery({
queryKey: [`allCasesQuery`],
queryFn: async () =>
await graphqlBatcher.fetch({ id: crypto.randomUUID(), document: allCasesQuery, variables: {} }),
await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: allCasesQuery,
chainId: DEFAULT_CHAIN,
variables: {},
}),
});
};
3 changes: 3 additions & 0 deletions web/src/hooks/queries/useCasesQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useQuery } from "@tanstack/react-query";
import { Address } from "viem";

import { useGraphqlBatcher } from "context/GraphqlBatcher";
import { DEFAULT_CHAIN } from "consts/chains";
import { isUndefined } from "utils/index";

import { graphql } from "src/graphql";
Expand Down Expand Up @@ -77,6 +78,7 @@ export const useCasesQuery = (skip = 0, first = 3, where?: Dispute_Filter, sortO
await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: isUndefined(where) ? casesQuery : casesQueryWhere,
chainId: DEFAULT_CHAIN,
variables: {
first,
skip,
Expand All @@ -98,6 +100,7 @@ export const useMyCasesQuery = (user?: Address, skip = 0, where?: Dispute_Filter
await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: isUndefined(where) ? myCasesQuery : myCasesQueryWhere,
chainId: DEFAULT_CHAIN,
variables: {
skip,
id: user?.toLowerCase(),
Expand Down
2 changes: 2 additions & 0 deletions web/src/hooks/queries/useClassicAppealQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useQuery } from "@tanstack/react-query";

import { REFETCH_INTERVAL } from "consts/index";
import { useGraphqlBatcher } from "context/GraphqlBatcher";
import { DEFAULT_CHAIN } from "consts/chains";

import { graphql } from "src/graphql";
import { ClassicAppealQuery } from "src/graphql/graphql";
Expand Down Expand Up @@ -49,6 +50,7 @@ export const useClassicAppealQuery = (id?: string | number) => {
? await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: classicAppealQuery,
chainId: DEFAULT_CHAIN,
variables: {
disputeID: id?.toString(),
orderBy: "timestamp",
Expand Down
9 changes: 8 additions & 1 deletion web/src/hooks/queries/useCounter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@tanstack/react-query";

import { useGraphqlBatcher } from "context/GraphqlBatcher";
import { DEFAULT_CHAIN } from "consts/chains";

import { graphql } from "src/graphql";
import { CounterQuery } from "src/graphql/graphql";
Expand Down Expand Up @@ -28,6 +29,12 @@ export const useCounterQuery = () => {

return useQuery<CounterQuery>({
queryKey: [`useCounterQuery`],
queryFn: async () => await graphqlBatcher.fetch({ id: crypto.randomUUID(), document: counterQuery, variables: {} }),
queryFn: async () =>
await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: counterQuery,
chainId: DEFAULT_CHAIN,
variables: {},
}),
});
};
8 changes: 7 additions & 1 deletion web/src/hooks/queries/useCourtDetails.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@tanstack/react-query";

import { REFETCH_INTERVAL } from "consts/index";
import { DEFAULT_CHAIN } from "consts/chains";
import { useGraphqlBatcher } from "context/GraphqlBatcher";

import { graphql } from "src/graphql";
Expand Down Expand Up @@ -37,6 +38,11 @@ export const useCourtDetails = (id?: string) => {
enabled: isEnabled,
refetchInterval: REFETCH_INTERVAL,
queryFn: async () =>
await graphqlBatcher.fetch({ id: crypto.randomUUID(), document: courtDetailsQuery, variables: { id } }),
await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: courtDetailsQuery,
chainId: DEFAULT_CHAIN,
variables: { id },
}),
});
};
2 changes: 2 additions & 0 deletions web/src/hooks/queries/useCourtPolicyURI.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@tanstack/react-query";

import { useGraphqlBatcher } from "context/GraphqlBatcher";
import { DEFAULT_CHAIN } from "consts/chains";
import { isUndefined } from "utils/index";

import { graphql } from "src/graphql";
Expand Down Expand Up @@ -29,6 +30,7 @@ export const useCourtPolicyURI = (id?: string | number) => {
? await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: courtPolicyURIQuery,
chainId: DEFAULT_CHAIN,
variables: { courtID: id.toString() },
})
: undefined,
Expand Down
8 changes: 7 additions & 1 deletion web/src/hooks/queries/useCourtTree.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@tanstack/react-query";

import { useGraphqlBatcher } from "context/GraphqlBatcher";
import { DEFAULT_CHAIN } from "consts/chains";

import { graphql } from "src/graphql";
import { CourtTreeQuery } from "src/graphql/graphql";
Expand Down Expand Up @@ -40,7 +41,12 @@ export const useCourtTree = () => {
return useQuery<CourtTreeQuery>({
queryKey: ["courtTreeQuery"],
queryFn: async () =>
await graphqlBatcher.fetch({ id: crypto.randomUUID(), document: courtTreeQuery, variables: {} }),
await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: courtTreeQuery,
chainId: DEFAULT_CHAIN,
variables: {},
}),
});
};

Expand Down
2 changes: 2 additions & 0 deletions web/src/hooks/queries/useDisputeDetailsQuery.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@tanstack/react-query";

import { REFETCH_INTERVAL } from "consts/index";
import { DEFAULT_CHAIN } from "consts/chains";
import { useGraphqlBatcher } from "context/GraphqlBatcher";

import { graphql } from "src/graphql";
Expand Down Expand Up @@ -50,6 +51,7 @@ export const useDisputeDetailsQuery = (id?: string | number) => {
await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: disputeDetailsQuery,
chainId: DEFAULT_CHAIN,
variables: { disputeID: id?.toString() },
}),
});
Expand Down
2 changes: 2 additions & 0 deletions web/src/hooks/queries/useDisputeMaintenanceQuery.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@tanstack/react-query";

import { useGraphqlBatcher } from "context/GraphqlBatcher";
import { DEFAULT_CHAIN } from "consts/chains";

import { graphql } from "src/graphql";
import { DisputeMaintenanceQuery } from "src/graphql/graphql";
Expand Down Expand Up @@ -44,6 +45,7 @@ const useDisputeMaintenanceQuery = (id?: string) => {
await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: disputeMaintenance,
chainId: DEFAULT_CHAIN,
variables: { disputeId: id?.toString(), disputeIdAsString: id?.toString() },
}),
});
Expand Down
2 changes: 2 additions & 0 deletions web/src/hooks/queries/useDisputeTemplateFromId.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@tanstack/react-query";

import { useGraphqlBatcher } from "context/GraphqlBatcher";
import { DEFAULT_CHAIN } from "consts/chains";
import { isUndefined } from "utils/index";

import { graphql } from "src/graphql";
Expand Down Expand Up @@ -29,6 +30,7 @@ export const useDisputeTemplateFromId = (templateId?: string) => {
await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: disputeTemplateQuery,
chainId: DEFAULT_CHAIN,
variables: { id: templateId?.toString() },
isDisputeTemplate: true,
}),
Expand Down
2 changes: 2 additions & 0 deletions web/src/hooks/queries/useDrawQuery.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@tanstack/react-query";

import { useGraphqlBatcher } from "context/GraphqlBatcher";
import { DEFAULT_CHAIN } from "consts/chains";

import { graphql } from "src/graphql";
import { DrawQuery } from "src/graphql/graphql";
Expand Down Expand Up @@ -31,6 +32,7 @@ export const useDrawQuery = (address?: string | null, disputeID?: string, roundI
await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: drawQuery,
chainId: DEFAULT_CHAIN,
variables: { address, disputeID, roundID },
}),
});
Expand Down
2 changes: 2 additions & 0 deletions web/src/hooks/queries/useEvidences.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@tanstack/react-query";

import { REFETCH_INTERVAL } from "consts/index";
import { DEFAULT_CHAIN } from "consts/chains";
import { useGraphqlBatcher } from "context/GraphqlBatcher";
import { transformSearch } from "utils/transformSearch";

Expand Down Expand Up @@ -56,6 +57,7 @@ export const useEvidences = (evidenceGroup?: string, keywords?: string) => {
const result = await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: document,
chainId: DEFAULT_CHAIN,
variables: { evidenceGroupID: evidenceGroup?.toString(), keywords: transformedKeywords },
});

Expand Down
2 changes: 2 additions & 0 deletions web/src/hooks/queries/useHomePageBlockQuery.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@tanstack/react-query";

import { useGraphqlBatcher } from "context/GraphqlBatcher";
import { DEFAULT_CHAIN } from "consts/chains";
import { isUndefined } from "utils/index";

import { graphql } from "src/graphql";
Expand Down Expand Up @@ -72,6 +73,7 @@ export const useHomePageBlockQuery = (blockNumber: number | undefined, allTime:
const data = await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: homePageBlockQuery,
chainId: DEFAULT_CHAIN,
variables: { blockNumber: targetBlock },
});

Expand Down
2 changes: 2 additions & 0 deletions web/src/hooks/queries/useHomePageQuery.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useQuery } from "@tanstack/react-query";

import { DEFAULT_CHAIN } from "consts/chains";
import { useGraphqlBatcher } from "context/GraphqlBatcher";

import { graphql } from "src/graphql";
Expand Down Expand Up @@ -40,6 +41,7 @@ export const useHomePageQuery = (timeframe: number) => {
const data = await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: homePageQuery,
chainId: DEFAULT_CHAIN,
variables: { timeframe: timeframe.toString() },
});
return data;
Expand Down
8 changes: 7 additions & 1 deletion web/src/hooks/queries/useJurorStakeDetailsQuery.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@tanstack/react-query";

import { REFETCH_INTERVAL } from "consts/index";
import { DEFAULT_CHAIN } from "consts/chains";
import { useGraphqlBatcher } from "context/GraphqlBatcher";

import { graphql } from "src/graphql";
Expand Down Expand Up @@ -30,6 +31,11 @@ export const useJurorStakeDetailsQuery = (userId?: string) => {
enabled: isEnabled,
refetchInterval: REFETCH_INTERVAL,
queryFn: async () =>
await graphqlBatcher.fetch({ id: crypto.randomUUID(), document: jurorStakeDetailsQuery, variables: { userId } }),
await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: jurorStakeDetailsQuery,
chainId: DEFAULT_CHAIN,
variables: { userId },
}),
});
};
2 changes: 2 additions & 0 deletions web/src/hooks/queries/useLabelInfoQuery.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useQuery } from "@tanstack/react-query";

import { DEFAULT_CHAIN } from "consts/chains";
import { useGraphqlBatcher } from "context/GraphqlBatcher";

import { graphql } from "src/graphql";
Expand Down Expand Up @@ -49,6 +50,7 @@ export const useLabelInfoQuery = (address?: string | null, disputeID?: string) =
await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: labelQuery,
chainId: DEFAULT_CHAIN,
variables: { address, disputeID },
}),
});
Expand Down
2 changes: 2 additions & 0 deletions web/src/hooks/queries/useTopUsersByCoherenceScore.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@tanstack/react-query";

import { useGraphqlBatcher } from "context/GraphqlBatcher";
import { DEFAULT_CHAIN } from "consts/chains";
import { isUndefined } from "utils/index";

import { graphql } from "src/graphql";
Expand Down Expand Up @@ -32,6 +33,7 @@ export const useTopUsersByCoherenceScore = (first = 5) => {
? await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: topUsersByCoherenceScoreQuery,
chainId: DEFAULT_CHAIN,
variables: {
first: first,
orderBy: "coherenceScore",
Expand Down
2 changes: 2 additions & 0 deletions web/src/hooks/queries/useUser.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@tanstack/react-query";
import { Address } from "viem";

import { DEFAULT_CHAIN } from "consts/chains";
import { useGraphqlBatcher } from "context/GraphqlBatcher";

import { graphql } from "src/graphql";
Expand Down Expand Up @@ -62,6 +63,7 @@ export const useUserQuery = (address?: Address, where?: Dispute_Filter) => {
await graphqlBatcher.fetch({
id: crypto.randomUUID(),
document: query,
chainId: DEFAULT_CHAIN,
variables: { address: address?.toLowerCase(), where },
}),
});
Expand Down
8 changes: 7 additions & 1 deletion web/src/hooks/queries/useVotingHistory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useQuery } from "@tanstack/react-query";

import { REFETCH_INTERVAL } from "consts/index";
import { DEFAULT_CHAIN } from "consts/chains";
import { useGraphqlBatcher } from "context/GraphqlBatcher";

import { graphql } from "src/graphql";
Expand Down Expand Up @@ -57,6 +58,11 @@ export const useVotingHistory = (disputeID?: string) => {
enabled: isEnabled,
refetchInterval: REFETCH_INTERVAL,
queryFn: async () =>
await graphqlBatcher.fetch({ id: crypto.randomUUID(), document: votingHistoryQuery, variables: { disputeID } }),
await graphqlBatcher.fetch({
id: crypto.randomUUID(),
chainId: DEFAULT_CHAIN,
document: votingHistoryQuery,
variables: { disputeID },
}),
});
};
1 change: 1 addition & 0 deletions web/src/layout/Header/navbar/Menu/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const StyledTabs = styled(Tabs)`
width: 86vw;
max-width: 660px;
align-self: center;

${landscapeStyle(
() => css`
width: ${responsiveSize(300, 424, 300)};
Expand Down
1 change: 1 addition & 0 deletions web/src/pages/GetPnk/Widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const WidgetContainer = styled.div`
}
}
`;

const getWidgetConfig = (theme: Theme): WidgetConfig => ({
fromChain: 1,
toChain: 42161,
Expand Down
Loading